]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Handle case that outer phi res is not used in a phi in gather_scalar_reductions
authorvries <vries@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 11 Jan 2016 09:19:33 +0000 (09:19 +0000)
committervries <vries@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 11 Jan 2016 09:19:33 +0000 (09:19 +0000)
2016-01-11  Tom de Vries  <tom@codesourcery.com>

PR tree-optimization/69108
* tree-parloops.c (gather_scalar_reductions): Handle case that outer phi
res is not used in a phi.

* gcc.dg/autopar/pr69108.c: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@232211 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/autopar/pr69108.c [new file with mode: 0644]
gcc/tree-parloops.c

index 29e45a62e42b62991b39d2f1007c58f97d111626..43623dcd9704c1f5b9b82c036c0e752306bb2951 100644 (file)
@@ -1,3 +1,9 @@
+2016-01-11  Tom de Vries  <tom@codesourcery.com>
+
+       PR tree-optimization/69108
+       * tree-parloops.c (gather_scalar_reductions): Handle case that outer phi
+       res is not used in a phi.
+
 2016-01-11  Yury Gribov  <y.gribov@samsung.com>
 
        PR 67425
index 615a527e1ce32bb03e3c3dbc80268514599985b2..ec4cd37f0004a3772659c296942846723cb0a2c4 100644 (file)
@@ -1,3 +1,8 @@
+2016-01-11  Tom de Vries  <tom@codesourcery.com>
+
+       PR tree-optimization/69108
+       * gcc.dg/autopar/pr69108.c: New test.
+
 2016-01-10  Patrick Palka  <ppalka@gcc.gnu.org>
 
        PR c++/69029
diff --git a/gcc/testsuite/gcc.dg/autopar/pr69108.c b/gcc/testsuite/gcc.dg/autopar/pr69108.c
new file mode 100644 (file)
index 0000000..39fc07e
--- /dev/null
@@ -0,0 +1,4 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -ftree-parallelize-loops=2" } */
+
+#include "../graphite/interchange-2.c"
index e05cc4746d71355b5a98157be55c8f1cf76fdcaf..d68370430c263fb2f0a4ac1c87e6c5590c5e4b8a 100644 (file)
@@ -2474,6 +2474,8 @@ gather_scalar_reductions (loop_p loop, reduction_info_table_type *reduction_list
          gimple *inner_stmt;
          bool single_use_p = single_imm_use (res, &use_p, &inner_stmt);
          gcc_assert (single_use_p);
+         if (gimple_code (inner_stmt) != GIMPLE_PHI)
+           continue;
          gphi *inner_phi = as_a <gphi *> (inner_stmt);
          if (simple_iv (loop->inner, loop->inner, PHI_RESULT (inner_phi),
                         &iv, true))