Handle case that outer phi res is not used in a phi in gather_scalar_reductions
2016-01-07 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.
---
gcc/testsuite/gcc.dg/autopar/pr69108.c | 4 ++++
gcc/tree-parloops.c | 2 ++
2 files changed, 6 insertions(+)
new file mode 100644
@@ -0,0 +1,4 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -ftree-parallelize-loops=2" } */
+
+#include "../graphite/interchange-2.c"
@@ -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))