tree-optimization/99880 - avoid vectorizing irrelevant PHI backedge defs
This adds a relevancy check before trying to set the vector def of a backedge in an unvectorized PHI. 2021-04-06 Richard Biener <rguenther@suse.de> PR tree-optimization/99880 * tree-vect-loop.c (maybe_set_vectorized_backedge_value): Only set vectorized defs of relevant PHIs. * gcc.dg/torture/pr99880.c: New testcase.
This commit is contained in:
parent
671f9f5c0f
commit
e5c170e080
22
gcc/testsuite/gcc.dg/torture/pr99880.c
Normal file
22
gcc/testsuite/gcc.dg/torture/pr99880.c
Normal file
@ -0,0 +1,22 @@
|
||||
/* { dg-do compile } */
|
||||
/* { dg-additional-options "-ftree-vectorize" } */
|
||||
|
||||
unsigned a;
|
||||
int b, c, d, e;
|
||||
void f() {
|
||||
b = 5;
|
||||
for (; b <= 51; b++)
|
||||
;
|
||||
unsigned int g = -8;
|
||||
while (g) {
|
||||
g += 5;
|
||||
int h = 10;
|
||||
do {
|
||||
h -= a = 1;
|
||||
for (; a; a++)
|
||||
;
|
||||
c *= c >= d >= b;
|
||||
} while (h);
|
||||
c -= e;
|
||||
}
|
||||
}
|
@ -9148,6 +9148,7 @@ maybe_set_vectorized_backedge_value (loop_vec_info loop_vinfo,
|
||||
if (gphi *phi = dyn_cast <gphi *> (USE_STMT (use_p)))
|
||||
if (gimple_bb (phi)->loop_father->header == gimple_bb (phi)
|
||||
&& (phi_info = loop_vinfo->lookup_stmt (phi))
|
||||
&& STMT_VINFO_RELEVANT_P (phi_info)
|
||||
&& VECTORIZABLE_CYCLE_DEF (STMT_VINFO_DEF_TYPE (phi_info))
|
||||
&& STMT_VINFO_REDUC_TYPE (phi_info) != FOLD_LEFT_REDUCTION
|
||||
&& STMT_VINFO_REDUC_TYPE (phi_info) != EXTRACT_LAST_REDUCTION)
|
||||
|
Loading…
Reference in New Issue
Block a user