mirror of
https://github.com/gcc-mirror/gcc.git
synced 2026-05-06 14:59:39 +02:00
tree-optimization/124677 - wrong recurrence permute placement
When vectorizing a recurrence we have to skip inserted vector stmts for the latch definition when finding the insertion point for the permute. PR tree-optimization/124677 * tree-vect-loop.cc (vectorizable_recurr): Skip vector stmts for the def. * gcc.dg/vect/vect-pr124677.c: New testcase.
This commit is contained in:
committed by
Richard Biener
parent
3d4039e95d
commit
32cb5f67ab
25
gcc/testsuite/gcc.dg/vect/vect-pr124677.c
Normal file
25
gcc/testsuite/gcc.dg/vect/vect-pr124677.c
Normal file
@@ -0,0 +1,25 @@
|
||||
/* { dg-do compile } */
|
||||
/* { dg-additional-options "-O3 -fno-tree-copy-prop" } */
|
||||
|
||||
int printf(const char *, ...);
|
||||
int a, b, c, d, e;
|
||||
int g(int h) { return h >> a; }
|
||||
int main()
|
||||
{
|
||||
int j = c;
|
||||
while (a)
|
||||
while (1)
|
||||
{
|
||||
while (1)
|
||||
{
|
||||
for (e = 0; e < 16; e++)
|
||||
{
|
||||
d = b;
|
||||
j && (b = g(2));
|
||||
}
|
||||
break;
|
||||
}
|
||||
printf("%d\n", b);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -8863,7 +8863,13 @@ vectorizable_recurr (loop_vec_info loop_vinfo, stmt_vec_info stmt_info,
|
||||
edge le = loop_latch_edge (LOOP_VINFO_LOOP (loop_vinfo));
|
||||
gimple *latch_def = SSA_NAME_DEF_STMT (PHI_ARG_DEF_FROM_EDGE (phi, le));
|
||||
gimple_stmt_iterator gsi2 = gsi_for_stmt (latch_def);
|
||||
gsi_next (&gsi2);
|
||||
do
|
||||
{
|
||||
gsi_next (&gsi2);
|
||||
}
|
||||
/* Skip inserted vectorized stmts for the latch definition. We have to
|
||||
insert after those. */
|
||||
while (gimple_uid (gsi_stmt (gsi2)) == 0);
|
||||
|
||||
for (unsigned i = 0; i < ncopies; ++i)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user