re PR tree-optimization/71503 (gcc ICE at -O3 on valid code on x86_64-linux-gnu in...
authorBin Cheng <bin.cheng@arm.com>
Wed, 20 Jul 2016 08:31:35 +0000 (08:31 +0000)
committerBin Cheng <amker@gcc.gnu.org>
Wed, 20 Jul 2016 08:31:35 +0000 (08:31 +0000)
PR tree-optimization/71503
PR tree-optimization/71683
* tree-if-conv.c (gen_phi_arg_condition): Record true predicate
and break.

gcc/testsuite
PR tree-optimization/71503
PR tree-optimization/71683
* gcc.dg/tree-ssa/ifc-pr71503.c: New test.
* gcc.dg/tree-ssa/ifc-pr71683.c: New test.

From-SVN: r238512

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/tree-ssa/ifc-pr71503.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/tree-ssa/ifc-pr71683.c [new file with mode: 0644]
gcc/tree-if-conv.c

index 82a473794e555ff4b7f1cfde12cf357aa3a06487..0b2eac8bccf14a12e9bfea75b5429769127d0d5c 100644 (file)
@@ -1,3 +1,10 @@
+2016-07-20  Bin Cheng  <bin.cheng@arm.com>
+
+       PR tree-optimization/71503
+       PR tree-optimization/71683
+       * tree-if-conv.c (gen_phi_arg_condition): Record true predicate
+       and break.
+
 2016-07-20  Martin Liska  <mliska@suse.cz>
 
        * doc/invoke.texi (-fipa-ra): Document when the option is
index 7f42fad40647a6b6a30c526497e4dcdc64219c88..e631db950576b6da41618dd978a8d5ec40f143ed 100644 (file)
@@ -1,3 +1,10 @@
+2016-07-20  Bin Cheng  <bin.cheng@arm.com>
+
+       PR tree-optimization/71503
+       PR tree-optimization/71683
+       * gcc.dg/tree-ssa/ifc-pr71503.c: New test.
+       * gcc.dg/tree-ssa/ifc-pr71683.c: New test.
+
 2016-07-20  Martin Liska  <mliska@suse.cz>
 
        * gcc.dg/plugin/plugin.exp: Remove sreal test.
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ifc-pr71503.c b/gcc/testsuite/gcc.dg/tree-ssa/ifc-pr71503.c
new file mode 100644 (file)
index 0000000..5a90abf
--- /dev/null
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-options "-Ofast" { target *-*-* } } */
+
+int a, b;
+unsigned long d;
+void fn1() {
+  unsigned long *h = &d;
+line1 : {
+  int i = 4;
+  for (; b; i++) {
+    d = ((d + 6 ?: *h) ? a : 7) && (i &= 0 >= b);
+    b += a;
+  }
+}
+  h = 0;
+  for (; *h;)
+    goto line1;
+}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ifc-pr71683.c b/gcc/testsuite/gcc.dg/tree-ssa/ifc-pr71683.c
new file mode 100644 (file)
index 0000000..851be37
--- /dev/null
@@ -0,0 +1,25 @@
+/* { dg-do compile } */
+/* { dg-options "-Ofast" { target *-*-* } } */
+
+short unsigned int ve;
+
+void
+u1 (void)
+{
+  int oq = 0;
+
+  while (ve != 0)
+    {
+      int j4, w7 = oq;
+
+      oq = 0 / oq;
+      ve %= oq;
+      j4 = ve ^ 1;
+      ve ^= oq;
+      if (j4 != 0 ? j4 : ve)
+        oq = ve;
+      else
+        if (w7 != 0)
+          oq = ve;
+    }
+}
index e5a3372cd4e3c11bc744a7847ac5576e7c5a336d..4253d194ed40552016fa9c976719e166bbdd6148 100644 (file)
@@ -1687,7 +1687,10 @@ gen_phi_arg_condition (gphi *phi, vec<int> *occur,
       e = gimple_phi_arg_edge (phi, (*occur)[i]);
       c = bb_predicate (e->src);
       if (is_true_predicate (c))
-       continue;
+       {
+         cond = c;
+         break;
+       }
       c = force_gimple_operand_gsi_1 (gsi, unshare_expr (c),
                                      is_gimple_condexpr, NULL_TREE,
                                      true, GSI_SAME_STMT);