pr45241 give up dot_prod pattern searching if stmt is outside the loop.

* tree-vect-patterns.c (vect_recog_dot_prod_pattern): Give
	up dot_prod pattern searching if a stmt is outside the loop.

	* gcc.dg/vect/no-tree-pre-pr45241.c: New.

From-SVN: r163207
This commit is contained in:
Changpeng Fang 2010-08-12 22:18:32 +00:00 committed by Changpeng Fang
parent 95718cf89d
commit 3cb35c1250
4 changed files with 35 additions and 0 deletions

View File

@ -1,3 +1,8 @@
2010-08-12 Changpeng Fang <changpeng.fang@amd.com>
* tree-vect-patterns.c (vect_recog_dot_prod_pattern): Give
up dot_prod pattern searching if a stmt is outside the loop.
2010-08-12 H.J. Lu <hongjiu.lu@intel.com>
Uros Bizjak <ubizjak@gmail.com>

View File

@ -1,3 +1,8 @@
2010-08-12 Changpeng Fang <changpeng.fang@amd.com>
PR tree-optimization/45241
* gcc.dg/vect/no-tree-pre-pr45241.c: New test.
2010-08-12 Uros Bizjak <ubizjak@gmail.com>
* gcc.target/i386/pr40906-1.c: Add -fno-asynchronous-unwind-tables

View File

@ -0,0 +1,20 @@
/* PR tree-optimization/45241 */
/* { dg-do compile } */
/* { dg-options "-ftree-vectorize" } */
int
foo (short x)
{
short i, y;
int sum;
for (i = 0; i < x; i++)
y = x * i;
for (i = x; i > 0; i--)
sum += y;
return sum;
}
/* { dg-final { cleanup-tree-dump "vect" } } */

View File

@ -255,6 +255,11 @@ vect_recog_dot_prod_pattern (gimple last_stmt, tree *type_in, tree *type_out)
prod_type = half_type;
stmt = SSA_NAME_DEF_STMT (oprnd0);
/* It could not be the dot_prod pattern if the stmt is outside the loop. */
if (!flow_bb_inside_loop_p (loop, gimple_bb (stmt)))
return NULL;
/* FORNOW. Can continue analyzing the def-use chain when this stmt in a phi
inside the loop (in case we are analyzing an outer-loop). */
if (!is_gimple_assign (stmt))