On 11/12/18 6:25 AM, Renlin Li wrote:
> I tried to build a native arm-linuxeabihf toolchain with the patch.
> But I got the following ICE:

Ok, the issue was a problem in handling the src reg from a register copy.
I thought I could just remove it from the dead_set, but forgot that the
updating of the program points looks at whether the pseudo is live or
not.  The change below on top of the previous patch fixes the ICE for me.
I now add the src reg back into pseudos_live before we process the insn's
input operands so it doesn't trigger a new program point being added.

Renlin and Jeff, can you apply this patch on top of the previous one
and see whether that is better?

Thanks.

Peter


--- gcc/lra-lives.c.orig        2018-11-12 14:15:18.257657911 -0600
+++ gcc/lra-lives.c     2018-11-12 14:08:55.978795092 -0600
@@ -934,6 +934,18 @@
          || sparseset_contains_pseudos_p (start_dying))
        next_program_point (curr_point, freq);
 
+      /* If we removed the source reg from a simple register copy from the
+        live set above, then add it back now so we don't accidentally add
+        it to the start_living set below.  */
+      if (ignore_reg != NULL_RTX)
+       {
+         int ignore_regno = REGNO (ignore_reg);
+         if (HARD_REGISTER_NUM_P (ignore_regno))
+           SET_HARD_REG_BIT (hard_regs_live, ignore_regno);
+         else
+           sparseset_set_bit (pseudos_live, ignore_regno);
+       }
+
       sparseset_clear (start_living);
 
       /* Mark each used value as live. */
@@ -959,11 +971,6 @@
 
       sparseset_and_compl (dead_set, start_living, start_dying);
 
-      /* If we removed the source reg from a simple register copy from the
-        live set, then it will appear to be dead, but it really isn't.  */
-      if (ignore_reg != NULL_RTX)
-       sparseset_clear_bit (dead_set, REGNO (ignore_reg));
-
       sparseset_clear (start_dying);
 
       /* Mark early clobber outputs dead.  */

Reply via email to