Fix PR66168
authorThomas Preud'homme <thomas.preudhomme@arm.com>
Thu, 28 May 2015 02:15:03 +0000 (02:15 +0000)
committerThomas Preud'homme <thopre01@gcc.gnu.org>
Thu, 28 May 2015 02:15:03 +0000 (02:15 +0000)
From-SVN: r223795

gcc/ChangeLog
gcc/loop-invariant.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/pr66168.c [new file with mode: 0644]

index 6a4571f635281fdcca8f2b53be3d568bdc57c71a..74be3c707e92986b5eee25dab11e3be9cb3e2d10 100644 (file)
@@ -1,3 +1,9 @@
+2015-05-28  Thomas Preud'homme  <thomas.preudhomme@arm.com>
+
+       PR rtl-optimization/66168
+       * loop-invariant.c (move_invariant_reg): Pass dest rather than reg to
+       can_move_invariant_reg.
+
 2015-05-27  John David Anglin  <danglin@gcc.gnu.org>
 
        PR target/66148
index 85270fe14bcf0b5aafdb773bf98f71acebc87d8c..c4321292b5ebce3b43ded34688f415b6250f218b 100644 (file)
@@ -1630,7 +1630,7 @@ move_invariant_reg (struct loop *loop, unsigned invno)
       if (REG_P (reg))
        regno = REGNO (reg);
 
-      if (!can_move_invariant_reg (loop, inv, reg))
+      if (!can_move_invariant_reg (loop, inv, dest))
        {
          reg = gen_reg_rtx_and_attrs (dest);
 
index a1a242e3bb52f77163a95ca19310dbc969089e0b..84b9fab017e957aafef22402bd8de63701c733ca 100644 (file)
@@ -1,3 +1,8 @@
+2015-05-28  Thomas Preud'homme  <thomas.preudhomme@arm.com>
+
+       PR rtl-optimization/66168
+       * gcc.c-torture/compile/pr66168.c: New test.
+
 2015-05-27  Jeff Law  <law@redhat.com>
 
        PR target/39726
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr66168.c b/gcc/testsuite/gcc.c-torture/compile/pr66168.c
new file mode 100644 (file)
index 0000000..d6bfc7b
--- /dev/null
@@ -0,0 +1,15 @@
+int a, b;
+
+void
+fn1 ()
+{
+  for (;;)
+    {
+      for (b = 0; b < 3; b++)
+       {
+         char e[2];
+         char f = e[1];
+         a ^= f ? 1 / f : 0;
+       }
+    }
+}