sccvn: finish elimination in vn_driver::finalize [PR126904]
Improves value numbering by ensuring elimination cleanup happens in finalize.
This commit refactors the value numbering driver (vn_driver) to ensure that cleanup operations related to value number elimination are performed in the finalize method. This change guarantees that the Intermediate Language (IL) state seen by subsequent passes, like the jump threader, accurately reflects the elimination process. The adjustment is primarily for correctness and does not introduce functional changes, ensuring that value numbers remain valid between optimization passes.
In Details
The vn_driver::finalize method now calls eliminate_cleanup to ensure that the Intermediate Language (IL) is left in a state consistent with the value numbers during iterative refinement (FRE). This is particularly important for the jump threader, which operates on the IL. Previously, elimination might have happened at different stages, potentially leading to inconsistencies. By moving eliminate_cleanup to finalize, the driver ensures that the IL is fully updated before the jump threader encounters it. This commit also introduces m_region_p and m_eliminator members to vn_driver a…
- Value Numbering (VN)
- An optimization technique that identifies and pools equivalent expressions based on their values, reducing redundant computations.
- SCCVN
- Strongly Connected Components Value Numbering. A value numbering algorithm that handles loops by identifying strongly connected components in the control flow graph.
- FRE
- Fast Relaxation-based Elimination. A specific optimization pass or technique likely related to dead code elimination or constant propagation, often working with value numbering.
- Jump Threader
- An optimization pass that analyzes control flow graphs to simplify jumps, potentially by removing redundant jumps or threading conditional branches directly to their targets.
- Intermediate Language (IL)
- An abstract representation of code used by compilers during optimization. GIMPLE is GCC's primary IL.
- SSA
- Static Single Assignment form. An intermediate representation where every variable is assigned exactly once, simplifying many optimization passes.