IPA ICF stability during LTO streaming
Preserves PHI operand order during LTO streaming to fix IPA ICF comparisons.
This change modifies the LTO streamer to preserve the order of predecessor edges, which in turn preserves the order of PHI operands. This is necessary because the previous implementation did not guarantee operand order, causing issues with IPA Inter-Chaining Function (ICF) reference comparisons. A new test case is included to verify the fix.
In Details
LTO streaming for IPA passes (like ICF) relies on the order of PHI node operands matching the order of basic block predecessors. The original LTO streamer didn't preserve this order, leading to IPA ICF misidentification of equivalent functions. This commit switches to streaming predecessor edges instead of successor edges to maintain the required order.
- IPA
- Inter-procedural Analysis. Compiler analysis that examines relationships between different functions or procedures in a program.
- ICF
- Identical Code Folding. An optimization that identifies and merges identical functions or code sections to reduce code size.
- LTO
- Link-Time Optimization. A compilation and linking process where optimization occurs after all translation units have been compiled, enabling cross-file analysis and optimization.
- PHI node
- A special node in Static Single Assignment (SSA) form that represents the value of a variable when control flow merges from multiple predecessors. It takes multiple operands, one from each incoming edge.