Preserve DECL_IGNORED_P for split partition declarations in out-of-SSA
The out-of-SSA pass now correctly preserves the `DECL_IGNORED_P` flag for split partition declarations, fixing potential register allocation issues at -O0.
The out-of-SSA transformation pass has been updated to correctly preserve the DECL_IGNORED_P flag when splitting overlapping partition declarations. This is particularly important at optimization level -O0, where incorrect handling of this flag could cause a replacement declaration to be allocated to a pseudo-register instead of memory, leading to conflicts. The change ensures that storage choices made during register coalescing are maintained, preventing issues with memory invariants.
In Details
In tree-outof-ssa.cc, the split_overlapping_partition_decls function now preserves DECL_IGNORED_P across the split of a partition's temporary variable. Previously, create_tmp_var_raw marked such temporaries as ignored, which could lead use_register_for_decl to select a pseudo register. This undermined coalescing's memory allocation choice for the original declaration when the replacement also needed memory, causing set_rtl to reject it. The fix ensures the replacement respects the original storage choice, and an assertion guards the memory invariant.
- out-of-SSA (O\SSA)
- A compiler transformation pass that converts the Static Single Assignment (SSA) form back into a more conventional three-address code representation. This is often necessary before certain optimization passes or for code generation.
- SSA form
- Static Single Assignment form. A program representation where every variable is assigned a value exactly once. This simplifies many compiler analyses and optimizations, but requires special handling for control flow (e.g., phi nodes).
- Partition declaration
- In GCC's internal representation, a 'partition' might refer to a set of related declarations or variables, possibly managed together during transformations. Splitting an 'overlapping partition' suggests handling cases where variables might share or interact with storage in complex ways.
- `DECL_IGNORED_P`
- A GCC internal flag on a declaration (
treenode) indicating that the declaration should be ignored by certain analyses or transformations. This commit ensures this flag is correctly propagated during SSA transformations. - Coalescing
- A register allocation technique where the compiler attempts to assign the same physical register to variables that are not simultaneously live, or to reuse registers efficiently. It often involves deciding whether a variable should reside in a register or in memory.
- -O0
- The GCC optimization level flag that requests no optimizations. Code is generated directly from the source with minimal transformations, focusing on debugging ease and build speed.