summaryrefslogtreecommitdiff
path: root/gcc/tree-vect-loop.c
diff options
context:
space:
mode:
authorcongh <congh@138bc75d-0d04-0410-961f-82ee72b054a4>2013-10-15 17:17:43 +0000
committercongh <congh@138bc75d-0d04-0410-961f-82ee72b054a4>2013-10-15 17:17:43 +0000
commit63048bd8158176564c0cfb2e45c3ad97143e99f6 (patch)
treea07346fb868983cc9fc591849d368b7924535e15 /gcc/tree-vect-loop.c
parent444c104638ff28f2f6bd8d0bf186e1601ced8997 (diff)
downloadgcc-63048bd8158176564c0cfb2e45c3ad97143e99f6.tar.gz
2013-10-15 Cong Hou <congh@google.com>
* tree-vect-loop.c (vect_is_simple_reduction_1): Relax the requirement of the reduction pattern so that one operand of the reduction operation can come from outside of the loop. 2013-10-15 Cong Hou <congh@google.com> * gcc.dg/vect/vect-reduc-pattern-3.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@203625 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-vect-loop.c')
-rw-r--r--gcc/tree-vect-loop.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c
index 638b981d5e7..d9125f690d2 100644
--- a/gcc/tree-vect-loop.c
+++ b/gcc/tree-vect-loop.c
@@ -2091,6 +2091,13 @@ vect_is_slp_reduction (loop_vec_info loop_info, gimple phi, gimple first_stmt)
a3 = ...
a2 = operation (a3, a1)
+ or
+
+ a3 = ...
+ loop_header:
+ a1 = phi < a0, a2 >
+ a2 = operation (a3, a1)
+
such that:
1. operation is commutative and associative and it is safe to
change the order of the computation (if CHECK_REDUCTION is true)
@@ -2451,6 +2458,7 @@ vect_is_simple_reduction_1 (loop_vec_info loop_info, gimple phi,
if (def2 && def2 == phi
&& (code == COND_EXPR
|| !def1 || gimple_nop_p (def1)
+ || !flow_bb_inside_loop_p (loop, gimple_bb (def1))
|| (def1 && flow_bb_inside_loop_p (loop, gimple_bb (def1))
&& (is_gimple_assign (def1)
|| is_gimple_call (def1)
@@ -2469,6 +2477,7 @@ vect_is_simple_reduction_1 (loop_vec_info loop_info, gimple phi,
if (def1 && def1 == phi
&& (code == COND_EXPR
|| !def2 || gimple_nop_p (def2)
+ || !flow_bb_inside_loop_p (loop, gimple_bb (def2))
|| (def2 && flow_bb_inside_loop_p (loop, gimple_bb (def2))
&& (is_gimple_assign (def2)
|| is_gimple_call (def2)