cmd/compile: PGO fails to do multiple levels of inlining into a single function #69046
Labels
compiler/runtime
Issues related to the Go compiler and/or runtime.
NeedsFix
The path to resolution is known, but the work has not been done.
Milestone
Reproducer:
https://go.dev/play/p/QxBt13wV3Uh
Run the benchmark to collect a profile, and then use that as a PGO profile:
The
hot-budget
lines note that PGO allows inliningb
intoa
anda
intoFoo
.dep/dep.go:32:3: inlining call to a
indicates thata
was inlined intoFoo
, but there should then be a subsequent inlineb
intoFoo
. The output makes this a bit confusing, but objdump makes it clear thatb
was not inlined:A bit of custom logging in the compiler makes it more clear what is happening:
It looks like what is happening here is:
a
in inlined intoFoo
.b
intoFoo
(from the inlined body ofa
).canInlineCallExpr
checksinlineCostOK
ofFoo -> b
. This consults the PGO edge map, which does not contain a hot edge fromFoo -> b
because PGO includes inline calls in edges. i.e., it has hot edgesFoo -> a
anda -> b
.I believe what should happen is if inlining a call inside of an
ir.InlinedCallExpr
, we should use the original name of theInlinedCallExpr
to consult the PGO edge map.cc @cherrymui
The text was updated successfully, but these errors were encountered: