]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR rtl-optimization/85645 (ICE in maybe_record_trace_start, at dwarf2cfi...
authorSegher Boessenkool <segher@kernel.crashing.org>
Mon, 13 Aug 2018 17:05:48 +0000 (19:05 +0200)
committerSegher Boessenkool <segher@gcc.gnu.org>
Mon, 13 Aug 2018 17:05:48 +0000 (19:05 +0200)
Backport from mainline
2018-05-09  Segher Boessenkool  <segher@kernel.crashing.org>

PR rtl-optimization/85645
* regrename.c (build_def_use): Also kill the chains that include the
destination of a REG_CFA_REGISTER note.

PR rtl-optimization/85645
*  regcprop.c (copyprop_hardreg_forward_1): Don't propagate into an
insn that has a REG_CFA_REGISTER note.

From-SVN: r263509

gcc/ChangeLog
gcc/regcprop.c
gcc/regrename.c

index 7f09f181a76d7357cab48b0a281bcf631089bd7a..526c332620a54c8d69495b8c8d9fdf0a23991825 100644 (file)
@@ -1,3 +1,16 @@
+2018-08-13  Segher Boessenkool  <segher@kernel.crashing.org>
+
+       Backport from mainline
+       2018-05-09  Segher Boessenkool  <segher@kernel.crashing.org>
+
+       PR rtl-optimization/85645
+       * regrename.c (build_def_use): Also kill the chains that include the
+       destination of a REG_CFA_REGISTER note.
+
+       PR rtl-optimization/85645
+       *  regcprop.c (copyprop_hardreg_forward_1): Don't propagate into an
+       insn that has a REG_CFA_REGISTER note.
+
 2018-08-10  Segher Boessenkool  <segher@kernel.crashing.org>
 
        Backport from mainline
index 367d85a7e242e9765767dcdd29080bd1fde3eb84..cf7ab901614b7005dd7084109b88c8b1d6dcf476 100644 (file)
@@ -854,6 +854,12 @@ copyprop_hardreg_forward_1 (basic_block bb, struct value_data *vd)
                  && reg_overlap_mentioned_p (XEXP (link, 0), SET_SRC (set)))
                set = NULL;
            }
+
+         /* We need to keep CFI info correct, and the same on all paths,
+            so we cannot normally replace the registers REG_CFA_REGISTER
+            refers to.  Bail.  */
+         if (REG_NOTE_KIND (link) == REG_CFA_REGISTER)
+           goto did_replacement;
        }
 
       /* Special-case plain move instructions, since we may well
index 58036644fc6acd5d16e4b78e1d30ac64c69ec908..7f2408a94df263dc93adacb35e3ad4b826a7e7ab 100644 (file)
@@ -1656,7 +1656,8 @@ build_def_use (basic_block bb)
             (6) For any non-earlyclobber write we find in an operand, make
                 a new chain or mark the hard register as live.
             (7) For any REG_UNUSED, close any chains we just opened.
-            (8) For any REG_CFA_RESTORE, kill any chain containing it.
+            (8) For any REG_CFA_RESTORE or REG_CFA_REGISTER, kill any chain
+                containing its dest.
 
             We cannot deal with situations where we track a reg in one mode
             and see a reference in another mode; these will cause the chain
@@ -1871,10 +1872,20 @@ build_def_use (basic_block bb)
              }
 
          /* Step 8: Kill the chains involving register restores.  Those
-            should restore _that_ register.  */
+            should restore _that_ register.  Similar for REG_CFA_REGISTER.  */
          for (note = REG_NOTES (insn); note; note = XEXP (note, 1))
-           if (REG_NOTE_KIND (note) == REG_CFA_RESTORE)
-             scan_rtx (insn, &XEXP (note, 0), NO_REGS, mark_all_read, OP_IN);
+           if (REG_NOTE_KIND (note) == REG_CFA_RESTORE
+               || REG_NOTE_KIND (note) == REG_CFA_REGISTER)
+             {
+               rtx *x = &XEXP (note, 0);
+               if (!*x)
+                 x = &PATTERN (insn);
+               if (GET_CODE (*x) == PARALLEL)
+                 x = &XVECEXP (*x, 0, 0);
+               if (GET_CODE (*x) == SET)
+                 x = &SET_DEST (*x);
+               scan_rtx (insn, x, NO_REGS, mark_all_read, OP_IN);
+             }
        }
       else if (DEBUG_INSN_P (insn)
               && !VAR_LOC_UNKNOWN_P (INSN_VAR_LOCATION_LOC (insn)))