tree-optimization/102142 - fix typo in loop BB reduc cost adjustment

This fixes a typo in the condition guarding the cleanup of the
visited flag of costed scalar stmts.

2021-08-31  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/102142
	* tree-vect-slp.c (vect_bb_vectorization_profitable_p): Fix
	condition under which to unset the visited flag.

	* g++.dg/torture/pr102142.C: New testcase.
This commit is contained in:
Richard Biener 2021-08-31 11:04:51 +02:00
parent de7a795c32
commit 6792734229
2 changed files with 10 additions and 1 deletions

View File

@ -0,0 +1,9 @@
/* { dg-do compile } */
extern short arr_597[];
extern bool arr_601[];
int test_var_13;
void test(short arr_391[][9][2][2]) {
for (int i_60 = 0; i_60 < 11; i_60 += test_var_13)
arr_597[22] = arr_601[i_60] = arr_391[0][0][1][4];
}

View File

@ -5396,7 +5396,7 @@ vect_bb_vectorization_profitable_p (bb_vec_info bb_vinfo,
/* Unset visited flag. This is delayed when the subgraph is profitable
and we process the loop for remaining unvectorized if-converted code. */
if (orig_loop && !profitable)
if (!orig_loop || !profitable)
FOR_EACH_VEC_ELT (scalar_costs, i, cost)
gimple_set_visited (cost->stmt_info->stmt, false);