cmd/compile: Optimise branches that could be behind other branches, to avoid running those branches when known to be false #46711
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
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
What did you expect to see?
I expected this code to be compiled to something equivalent to
to avoid checking for
a == 1<<31 || b.num == 1<<31
when it is known to not be true.Of course this is only possible when all the operations in between are known to not affect the return, or have any other side-effects.
What did you see instead?
This optimization is not applied.
The text was updated successfully, but these errors were encountered: