ifcvt: Fix PHI node updates in factor_out_operators
Correctly updates PHI nodes in the ifcvt pass to fix a reduction bug.
The ifcvt (if conversion) pass in GCC had a latent bug where it bypassed normal PHI node update functions when factoring out operators. This led to incorrect SSA information, causing a reduction patch to ICE by incorrectly passing a single-use check. This commit fixes the issue by using the proper PHI update functions, resolving the ICE and enabling the reduction.
In Details
This commit corrects a bug in tree-if-conv.cc's factor_out_operators function. It previously mishandled SSA updates for PHI nodes by bypassing update_phi_node and relying on a no-op update_stmt for PHI nodes. This led to incorrect SSA form, causing mispredictions in subsequent passes like reduction which rely on accurate single-use analysis. The fix ensures proper PHI node updates, restoring SSA correctness.
- ifcvt
- The if-conversion pass in GCC, which transforms conditional control flow (if-statements) into predicated instructions or equivalent structures. This can enable better instruction-level parallelism.
- SSA
- Static Single Assignment form is an intermediate representation used in compilers. In SSA, every variable is assigned a value only once. This simplifies many data-flow analyses and optimizations.
- PHI node
- A special node in SSA form that represents the merging of values from different control flow paths. It denotes which of the incoming values should be used at that point.
- ICE
- Internal Compiler Error. A severe error that occurs within the compiler itself, usually indicating a bug in the compiler's logic or an unhandled edge case.
- reduction
- In the context of optimizations, a reduction refers to a transformation that simplifies or combines operations, often reducing the number of instructions or data dependencies.