cmd/compile: optimize x * const == const (and friends) #19655
Labels
FrozenDueToAge
help wanted
Performance
Suggested
Issues that may be good for new contributors looking for work to do.
Milestone
Currently compiles to:
Instead of multiplying (shifting), we should just compare to 8.
Real world example, from code I'm writing right now:
This is one of a family of generic optimizations. Care required in some cases (overflow, div by zero, etc.).
cc @randall77 @philhofer @martisch
The text was updated successfully, but these errors were encountered: