cmd/compile: opt should match rules through phis #53300
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
The ssa opt pass currently abort matching if the rule go through a phis.
For example:
Should be rewriten:
The necessary rules for that optimization already exists, but they can't be applied since a phi node is in the way.
When encountering a phi node opt should start a routine to apply the rule on all branches where that would remove uses of the previous values in that branch (this is because we don't want to generate dupped code that would slower) (and generate a new fallback block that applies the current operation for branches that didn't matched).
This could lead to a jump in codesize since multiple branches might have the same rules applies to them.
A pass that perform CSE but downward in the control flow would regain that lost space.
The extra compilation time cost might not be worth it.
The text was updated successfully, but these errors were encountered: