https://gcc.gnu.org/g:53555e8226f87db51448b7832da3b7cea976fc8e

commit 53555e8226f87db51448b7832da3b7cea976fc8e
Author: Alexandre Oliva <[email protected]>
Date:   Tue Sep 9 19:28:23 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.

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