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 6a4571f..74be3c7 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 85270fe..c432129 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 a1a242e..84b9fab 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;
+       }
+    }
+}