]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Backport PRs 64682, 69567, 69737, 82683
authorSegher Boessenkool <segher@kernel.crashing.org>
Thu, 9 Nov 2017 10:23:30 +0000 (11:23 +0100)
committerSegher Boessenkool <segher@gcc.gnu.org>
Thu, 9 Nov 2017 10:23:30 +0000 (11:23 +0100)
Backport from mainline
2017-11-01  Segher Boessenkool  <segher@kernel.crashing.org>

PR rtl-optimization/64682
PR rtl-optimization/69567
PR rtl-optimization/69737
PR rtl-optimization/82683
* combine.c (distribute_notes) <REG_DEAD>: If the new I2 sets the same
register mentioned in the note, drop the note, unless it came from I3,
in which case it should go to I3 again.

From-SVN: r254565

gcc/ChangeLog
gcc/combine.c

index 8c980ab700befcf13576d072c58e41d2bb1388a1..32ad2d585d19ce08373291ff41369dda4038cfd3 100644 (file)
@@ -1,3 +1,16 @@
+2017-11-09  Segher Boessenkool  <segher@kernel.crashing.org>
+
+       Backport from mainline
+       2017-11-01  Segher Boessenkool  <segher@kernel.crashing.org>
+
+       PR rtl-optimization/64682
+       PR rtl-optimization/69567
+       PR rtl-optimization/69737
+       PR rtl-optimization/82683
+       * combine.c (distribute_notes) <REG_DEAD>: If the new I2 sets the same
+       register mentioned in the note, drop the note, unless it came from I3,
+       in which case it should go to I3 again.
+
 2017-10-31  Uros Bizjak  <ubizjak@gmail.com>
 
        PR target/82772
index 5e33746a83eb5d3fc7f5b064f1a8445b43ccd087..a989659f2888bbc7da95b659afbd2097243ccc64 100644 (file)
@@ -13941,6 +13941,17 @@ distribute_notes (rtx notes, rtx_insn *from_insn, rtx_insn *i3, rtx_insn *i2,
                  && CALL_P (from_insn)
                  && find_reg_fusage (from_insn, USE, XEXP (note, 0)))
                place = from_insn;
+             else if (i2 && reg_set_p (XEXP (note, 0), PATTERN (i2)))
+               {
+                 /* If the new I2 sets the same register that is marked
+                    dead in the note, we do not in general know where to
+                    put the note.  One important case we _can_ handle is
+                    when the note comes from I3.  */
+                 if (from_insn == i3)
+                   place = i3;
+                 else
+                   break;
+               }
              else if (reg_referenced_p (XEXP (note, 0), PATTERN (i3)))
                place = i3;
              else if (i2 != 0 && next_nonnote_nondebug_insn (i2) == i3
@@ -13954,11 +13965,6 @@ distribute_notes (rtx notes, rtx_insn *from_insn, rtx_insn *i3, rtx_insn *i2,
                       || rtx_equal_p (XEXP (note, 0), elim_i0))
                break;
              tem_insn = i3;
-             /* If the new I2 sets the same register that is marked dead
-                in the note, we do not know where to put the note.
-                Give up.  */
-             if (i2 != 0 && reg_set_p (XEXP (note, 0), PATTERN (i2)))
-               break;
            }
 
          if (place == 0)