cmd/compile: eliminate unnecessary extend-of-truncate calculations in prove pass #27572
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
Consider:
If, when inlined, x is known to be small, then f can be replaced by the identity function.
I was curious, so I sketched this quickly for a specific case by adding this case to
func simplifyBlock
in prove.go:It triggers just a few times during make.bash.
This issue is to explore whether adding more cases makes this trigger enough times to be worth doing. There are lots more variants of signed/zero extension, and maybe other ways to generalize this optimization. (It also needs tests, both of correctness and that the optimization triggers.) Also, my limit tests in the code above could easily have fencepost problems. :)
cc @rasky @randall77
The text was updated successfully, but these errors were encountered: