]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR target/64479 ([SH] wrong optimization delayed-branch)
authorOleg Endo <olegendo@gcc.gnu.org>
Tue, 13 Jan 2015 01:18:56 +0000 (01:18 +0000)
committerOleg Endo <olegendo@gcc.gnu.org>
Tue, 13 Jan 2015 01:18:56 +0000 (01:18 +0000)
gcc/
Backport form mainline
2015-01-13  Oleg Endo  <olegendo@gcc.gnu.org>

PR target/64479
* rtlanal.c (set_reg_p): Handle SEQUENCE constructs.

From-SVN: r219508

gcc/ChangeLog
gcc/rtlanal.c

index 484f0c9979cae6a4b8e85cf5ee5e64d33adba4ea..189c068e2cd914e9c41529258061352fdeac7fde 100644 (file)
@@ -1,3 +1,11 @@
+2015-01-13  Oleg Endo  <olegendo@gcc.gnu.org>
+
+       Backport form mainline
+       2015-01-13  Oleg Endo  <olegendo@gcc.gnu.org>
+
+       PR target/64479
+       * rtlanal.c (set_reg_p): Handle SEQUENCE constructs.
+
 2014-12-27  H.J. Lu  <hongjiu.lu@intel.com>
 
        Backport from mainline:
index 89455d3615b37c4a703c354b53f135289ba78dc7..dcb23cc5916d680e364ea98571ea427a99b05b30 100644 (file)
@@ -873,6 +873,17 @@ reg_set_between_p (const_rtx reg, const_rtx from_insn, const_rtx to_insn)
 int
 reg_set_p (const_rtx reg, const_rtx insn)
 {
+  /* After delay slot handling, call and branch insns might be in a
+     sequence.  Check all the elements there.  */
+  if (INSN_P (insn) && GET_CODE (PATTERN (insn)) == SEQUENCE)
+    {
+      for (int i = 0; i < XVECLEN (PATTERN (insn), 0); ++i)
+       if (reg_set_p (reg, XVECEXP (PATTERN (insn), 0, i)))
+         return true;
+
+      return false;
+    }
+
   /* We can be passed an insn or part of one.  If we are passed an insn,
      check if a side-effect of the insn clobbers REG.  */
   if (INSN_P (insn)
@@ -884,7 +895,7 @@ reg_set_p (const_rtx reg, const_rtx insn)
                                               GET_MODE (reg), REGNO (reg)))
                  || MEM_P (reg)
                  || find_reg_fusage (insn, CLOBBER, reg)))))
-    return 1;
+    return true;
 
   return set_of (reg, insn) != NULL_RTX;
 }