diff options
author | Richard Biener <rguenther@suse.de> | 2016-01-14 15:13:19 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2016-01-14 15:13:19 +0000 |
commit | 3688e13db33177ac065aa0064ebd68e0afbadc66 (patch) | |
tree | 8eb78b811d515f9b30d20fdf5618d44d172cbe7b /gcc | |
parent | a2ae4661ab37d05dc2610fb8bc1a6a32b2928748 (diff) | |
download | gcc-3688e13db33177ac065aa0064ebd68e0afbadc66.zip gcc-3688e13db33177ac065aa0064ebd68e0afbadc66.tar.gz gcc-3688e13db33177ac065aa0064ebd68e0afbadc66.tar.bz2 |
re PR tree-optimization/68060 (ICE on valid code at -O3 on x86_64-linux-gnu in vect_get_vec_def_for_operand, at tree-vect-stmts.c:1413)
2016-01-14 Richard Biener <rguenther@suse.de>
PR tree-optimization/68060
* tree-vect-loop.c (vect_is_simple_reduction): Check the
outer loop reduction is only used in the inner loop before
detecting a double reduction.
* gcc.dg/torture/pr68060-1.c: New testcase.
* gcc.dg/torture/pr68060-2.c: Likewise.
From-SVN: r232367
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/torture/pr68060-1.c | 16 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/torture/pr68060-2.c | 20 | ||||
-rw-r--r-- | gcc/tree-vect-loop.c | 7 |
5 files changed, 54 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index fe9a60a..77e379c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2016-01-14 Richard Biener <rguenther@suse.de> + + PR tree-optimization/68060 + * tree-vect-loop.c (vect_is_simple_reduction): Check the + outer loop reduction is only used in the inner loop before + detecting a double reduction. + 2016-01-14 Jakub Jelinek <jakub@redhat.com> PR target/68269 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ef76d22..e10a214 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2016-01-14 Richard Biener <rguenther@suse.de> + + PR tree-optimization/68060 + * gcc.dg/torture/pr68060-1.c: New testcase. + * gcc.dg/torture/pr68060-2.c: Likewise. + 2016-01-14 Nick Clifton <nickc@redhat.com> * lib/target-supports.exp diff --git a/gcc/testsuite/gcc.dg/torture/pr68060-1.c b/gcc/testsuite/gcc.dg/torture/pr68060-1.c new file mode 100644 index 0000000..8830d87 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr68060-1.c @@ -0,0 +1,16 @@ +/* { dg-do compile } */ + +int a, b, c; + +int +main () +{ + for (; c; c++) + for (a = 0; a < 4; a++) + { + c &= 5; + for (b = 0; b < 2; b++) + c |= 1; + } + return 0; +} diff --git a/gcc/testsuite/gcc.dg/torture/pr68060-2.c b/gcc/testsuite/gcc.dg/torture/pr68060-2.c new file mode 100644 index 0000000..974ddc7 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr68060-2.c @@ -0,0 +1,20 @@ +/* { dg-do compile } */ + +void fn2 (); + +int a, b, c; + +void fn1() +{ + for (;;) { + int *d; + fn2(); + c = 0; + for (; c <= 3; c++) { + *d ^= 9; + b = 0; + for (; b <= 3; b++) + *d ^= a; + } + } +} diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c index 0933e7e..b095f8f 100644 --- a/gcc/tree-vect-loop.c +++ b/gcc/tree-vect-loop.c @@ -2591,7 +2591,7 @@ vect_is_simple_reduction (loop_vec_info loop_info, gimple *phi, struct loop *vect_loop = LOOP_VINFO_LOOP (loop_info); edge latch_e = loop_latch_edge (loop); tree loop_arg = PHI_ARG_DEF_FROM_EDGE (phi, latch_e); - gimple *def_stmt, *def1 = NULL, *def2 = NULL; + gimple *def_stmt, *def1 = NULL, *def2 = NULL, *phi_use_stmt = NULL; enum tree_code orig_code, code; tree op1, op2, op3 = NULL_TREE, op4 = NULL_TREE; tree type; @@ -2640,6 +2640,8 @@ vect_is_simple_reduction (loop_vec_info loop_info, gimple *phi, "reduction used in loop.\n"); return NULL; } + + phi_use_stmt = use_stmt; } if (TREE_CODE (loop_arg) != SSA_NAME) @@ -2722,7 +2724,8 @@ vect_is_simple_reduction (loop_vec_info loop_info, gimple *phi, && flow_bb_inside_loop_p (loop, gimple_bb (def_stmt)) && loop->inner && flow_bb_inside_loop_p (loop->inner, gimple_bb (def1)) - && is_gimple_assign (def1)) + && is_gimple_assign (def1) + && flow_bb_inside_loop_p (loop->inner, gimple_bb (phi_use_stmt))) { if (dump_enabled_p ()) report_vect_op (MSG_NOTE, def_stmt, |