cmd/compile: prefer to cheaply re-materialize after call site instead of spilling #32255
Labels
compiler/runtime
Issues related to the Go compiler and/or runtime.
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Performance
Milestone
go tip
While working on changing runtime.growslice to not return the length of the new slice (like was done for runtime.makeslice 020a18c) I ran into the issue of not being able to make the compiler rematerialize the new slice length instead of spilling it in
go/src/cmd/compile/internal/gc/ssa.go
Line 2479 in d97bd5d
There generally seems to be a missed opportunity for the compiler to prefer recomputing a value that is cheap to compute from other values that too need to be loaded after a call.
Hand distilled example:
produces:
Neither
Or
avoids the spilling.
@josharian @randall77 @cherrymui
The text was updated successfully, but these errors were encountered: