summaryrefslogtreecommitdiff
path: root/gcc/tree-vect-loop.c
diff options
context:
space:
mode:
authorirar <irar@138bc75d-0d04-0410-961f-82ee72b054a4>2011-08-01 16:58:20 +0000
committerirar <irar@138bc75d-0d04-0410-961f-82ee72b054a4>2011-08-01 16:58:20 +0000
commit6b809b999a43145d60610dfe71598daeadae0378 (patch)
treeee9c0562d8abcd98e8100161a75488131a8a66cf /gcc/tree-vect-loop.c
parent9c714f97bd994e38c2ce9ae002521d5d120878b7 (diff)
downloadgcc-6b809b999a43145d60610dfe71598daeadae0378.tar.gz
PR tree-optimization/49926
* tree-vect-loop.c (vect_is_slp_reduction): Check that a statement in a chain doesn't have uses both inside and outside the loop. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@177063 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-vect-loop.c')
-rw-r--r--gcc/tree-vect-loop.c27
1 files changed, 17 insertions, 10 deletions
diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c
index 63b346979af..505a41acb03 100644
--- a/gcc/tree-vect-loop.c
+++ b/gcc/tree-vect-loop.c
@@ -1730,7 +1730,7 @@ vect_is_slp_reduction (loop_vec_info loop_info, gimple phi, gimple first_stmt)
tree lhs;
imm_use_iterator imm_iter;
use_operand_p use_p;
- int nloop_uses, size = 0;
+ int nloop_uses, size = 0, n_out_of_loop_uses;
bool found = false;
if (loop != vect_loop)
@@ -1741,6 +1741,7 @@ vect_is_slp_reduction (loop_vec_info loop_info, gimple phi, gimple first_stmt)
while (1)
{
nloop_uses = 0;
+ n_out_of_loop_uses = 0;
FOR_EACH_IMM_USE_FAST (use_p, imm_iter, lhs)
{
gimple use_stmt = USE_STMT (use_p);
@@ -1757,16 +1758,22 @@ vect_is_slp_reduction (loop_vec_info loop_info, gimple phi, gimple first_stmt)
break;
}
- if (flow_bb_inside_loop_p (loop, gimple_bb (use_stmt))
- && vinfo_for_stmt (use_stmt)
- && !STMT_VINFO_IN_PATTERN_P (vinfo_for_stmt (use_stmt)))
- {
- loop_use_stmt = use_stmt;
- nloop_uses++;
- }
+ if (flow_bb_inside_loop_p (loop, gimple_bb (use_stmt)))
+ {
+ if (vinfo_for_stmt (use_stmt)
+ && !STMT_VINFO_IN_PATTERN_P (vinfo_for_stmt (use_stmt)))
+ {
+ loop_use_stmt = use_stmt;
+ nloop_uses++;
+ }
+ }
+ else
+ n_out_of_loop_uses++;
- if (nloop_uses > 1)
- return false;
+ /* There are can be either a single use in the loop or two uses in
+ phi nodes. */
+ if (nloop_uses > 1 || (n_out_of_loop_uses && nloop_uses))
+ return false;
}
if (found)