re PR middle-end/81832 (ICE in expand_LOOP_DIST_ALIAS, at internal-fn.c:2273)
authorBin Cheng <bin.cheng@arm.com>
Wed, 16 Aug 2017 15:02:03 +0000 (15:02 +0000)
committerBin Cheng <amker@gcc.gnu.org>
Wed, 16 Aug 2017 15:02:03 +0000 (15:02 +0000)
PR tree-optimization/81832
* tree-ssa-loop-ch.c (should_duplicate_loop_header_p): Don't
copy loop header which has IFN_LOOP_DIST_ALIAS call.

gcc/testsuite
* gcc.dg/tree-ssa/pr81832.c: New test.

From-SVN: r251123

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/tree-ssa/pr81832.c [new file with mode: 0644]
gcc/tree-ssa-loop-ch.c

index 6cd2ea6616feb683f8bb2175ff10c669da2da772..eb3277224b021c6c6636d01faf4b95103109bbff 100644 (file)
@@ -1,3 +1,9 @@
+2017-08-16  Bin Cheng  <bin.cheng@arm.com>
+
+       PR tree-optimization/81832
+       * tree-ssa-loop-ch.c (should_duplicate_loop_header_p): Don't
+       copy loop header which has IFN_LOOP_DIST_ALIAS call.
+
 2017-08-16  Marek Polacek  <polacek@redhat.com>
 
        PR middle/81695
index fe2ea0221f8502afb55f3a2bacbea84b5bfbc91c..717e951a8ccbe609ae5bfa57c6feacee3033dcf6 100644 (file)
@@ -1,3 +1,8 @@
+2017-08-16  Bin Cheng  <bin.cheng@arm.com>
+
+       PR tree-optimization/81832
+       * gcc.dg/tree-ssa/pr81832.c: New test.
+
 2017-08-16  Richard Sandiford  <richard.sandiford@linaro.org>
 
        PR tree-optimization/81835
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr81832.c b/gcc/testsuite/gcc.dg/tree-ssa/pr81832.c
new file mode 100644 (file)
index 0000000..893124e
--- /dev/null
@@ -0,0 +1,22 @@
+/* { dg-do compile } */
+/* { dg-options "-O3" } */
+
+int a, b, *c;
+void d(void)
+{
+    int **e;
+    for(;;)
+        for(int f = 1; f <= 6; f++)
+        {
+            b = 0;
+            if(a)
+g:
+                while(a++);
+            if (**e);
+            else
+            {
+                *c = a;
+                goto g;
+            }
+        }
+}
index 14cc6d8d72149f6d1d6ae177faa2ce1b47c1547f..6bb0220f0dc857893390dba376c56ae466111e0f 100644 (file)
@@ -119,7 +119,10 @@ should_duplicate_loop_header_p (basic_block header, struct loop *loop,
        continue;
 
       if (gimple_code (last) == GIMPLE_CALL
-         && !gimple_inexpensive_call_p (as_a <gcall *> (last)))
+         && (!gimple_inexpensive_call_p (as_a <gcall *> (last))
+             /* IFN_LOOP_DIST_ALIAS means that inner loop is distributed
+                at current loop's header.  Don't copy in this case.  */
+             || gimple_call_internal_p (last, IFN_LOOP_DIST_ALIAS)))
        {
          if (dump_file && (dump_flags & TDF_DETAILS))
            fprintf (dump_file,