Some ports were failing an assertion check that was supposed to make
sure some RTX created a new VALUE, rather than reuse an existing one in
the cselib tables.  The reason the value was already there was that we'd
recorded the register in the permanent table as the CFA, but the
register was correctly used for other purposes by the compiler itself,
we'd just failed to refrain from take note of that in this particular
code path.  Other paths that register the CFA base value are guarded by
this condition, and guarding this one fixed the problem on the affected
ports.

Regstrapped on x86_64-linux-gnu and i686-linux-gnu; in the PR, the
problem is confirmed fixed by this patch on the rx and lm32 ports too.
Ok?


for  gcc/ChangeLog

        PR debug/57232
        * var-tracking.c (vt_initialize): Apply the same condition to
        preserve the CFA base value.
---
 gcc/var-tracking.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gcc/var-tracking.c b/gcc/var-tracking.c
index c5ce1dd..65d8285 100644
--- a/gcc/var-tracking.c
+++ b/gcc/var-tracking.c
@@ -9924,7 +9924,8 @@ vt_initialize (void)
       val = cselib_lookup_from_insn (reg, GET_MODE (reg), 1,
                                     VOIDmode, get_insns ());
       preserve_value (val);
-      cselib_preserve_cfa_base_value (val, REGNO (reg));
+      if (reg != hard_frame_pointer_rtx && fixed_regs[REGNO (reg)])
+       cselib_preserve_cfa_base_value (val, REGNO (reg));
       expr = plus_constant (GET_MODE (stack_pointer_rtx),
                            stack_pointer_rtx, -ofst);
       cselib_add_permanent_equiv (val, expr, get_insns ());


-- 
Alexandre Oliva, freedom fighter    http://FSFLA.org/~lxoliva/
You must be the change you wish to see in the world. -- Gandhi
Be Free! -- http://FSFLA.org/   FSF Latin America board member
Free Software Evangelist     Red Hat Brazil Toolchain Engineer

Reply via email to