tree-optimization/60075 - fix address-space handling in PRE
Corrects address-space handling in the PRE optimization pass.
This commit fixes an issue in the Partial Redundancy Elimination (PRE) optimization pass where address-space qualification was disregarded when handling COMPONENT_REF operations. By ensuring that the address-space context is correctly considered, this resolves a bug (PR60075) and ensures more accurate optimization. A new test case has been added to verify the fix.
In Details
In the SSA-based PRE pass (tree-ssa-pre.cc) and its verification component (tree-ssa-sccvn.cc), COMPONENT_REF operations were not correctly preserving address-space information derived from the FIELD_DECL. This commit modifies copy_reference_ops_from_ref and create_component_ref_by_pieces_1 to properly account for address-space qualifiers, fixing PR60075.
- PRE
- Partial Redundancy Elimination is a compiler optimization technique that eliminates redundant computations within a program. It aims to compute each expression at most once.
- COMPONENT_REF
- A GCC internal representation node used to access a member of a structure or array. It represents dereferencing a pointer to a structure and accessing a specific field.
- FIELD_DECL
- A declaration of a field within a structure or union type in GCC's internal representation.
- address-space qualification
- Specifies that a memory access or pointer refers to a particular memory region or segment, which can affect how accesses are performed and optimized.
- SSA
- Static Single Assignment form is an intermediate representation for compilers where every variable is assigned exactly once. It simplifies many optimization passes.