sccvn: keep the executable dominators until finalize [PR128182]
Fixes a bootstrap failure by ensuring executable dominators are kept until the finalize step in sccvn.
This commit addresses a bootstrap failure in the sccvn (Strongly Connected Components Value Numbering) pass by correctly handling executable dominators. A previous change introduced a global table, vn_exec_idom, which needs to be managed by the vn_driver::finalize method. The driver now owns this table, ensuring it is available and correctly pointed to during the finalization process, which also involves updating vn_bb_to_rpo. This keeps the value numbers consistent between the walk and finalize stages.
In Details
The sccvn pass's vn_driver now explicitly manages the vn_exec_idom global table. Previously, this table was allocated and freed within do_rpo_vn_1, leading to a bootstrap failure when vn_driver::finalize was called after this cleanup. The fix involves the vn_driver allocating m_exec_idom in its constructor and freeing it in its destructor. The finalize method now correctly points internal structures like vn_bb_to_rpo to the driver's tables, ensuring that executable dominator information is available throughout the relevant compilation stages.
- sccvn
- Strongly Connected Components Value Numbering, an optimization pass in GCC that identifies and reuses computations within loops and other control flow structures.
- dominator
- In control flow analysis, a node A dominates node B if every path from the entry node to node B must pass through node A.
- executable dominators
- Dominators that are part of executable code paths, relevant for certain optimization analyses.
- finalize
- A stage in a compiler pass where intermediate data structures are processed or cleaned up before the pass completes.
- bootstrap failure
- An error that occurs during the process of building a compiler using an earlier version of itself. This indicates a problem that prevents the compiler from being self-hosted.
- RPO numbering
- Reverse Post-Order numbering, a common graph traversal ordering used in compiler optimizations, particularly for control flow graphs.