https://gcc.gnu.org/g:9b6e292958015cba1dd544e40fd93da6f96d6a0b

commit 9b6e292958015cba1dd544e40fd93da6f96d6a0b
Author: Alexandre Oliva <[email protected]>
Date:   Tue Sep 9 23:09:53 2025 -0300

    [ira] avoid resetting ira_reg_equiv for function invariants
    
    An aarch64 toolchain built with --enable-default-pie fails
    gcc.target/aarch64/sme/nonlocal_goto_[123].c because the register
    allocator ends up resetting equivalences, so it concludes it needs to
    preserve a rematerializable function invariant across a call instead
    of rematerializing it.
    
    Allow function invariant equivalences to remain when the other
    circumstances that may require their removal don't apply.
    
    
    for  gcc/ChangeLog
    
            * ira.cc (setup_reg_equiv): Retain function invariant
            equivalences.

Diff:
---
 gcc/ira.cc | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/gcc/ira.cc b/gcc/ira.cc
index 4eebc9c4c50f..79cf9a413cfb 100644
--- a/gcc/ira.cc
+++ b/gcc/ira.cc
@@ -4278,6 +4278,9 @@ setup_reg_equiv (void)
                    continue;
                  }
              }
+           else if (function_invariant_p (x))
+             /* Leave ira_reg_equiv alone.  */
+             continue;
          }
        ira_reg_equiv[i].defined_p = false;
        ira_reg_equiv[i].caller_save_p = false;

Reply via email to