diff --git a/gcc/testsuite/gcc.dg/pr102152.c b/gcc/testsuite/gcc.dg/pr102152.c new file mode 100644 index 00000000000..4e0c1f5a3d5 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr102152.c @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -ftree-loop-vectorize -fno-tree-fre" } */ +/* { dg-additional-options "-march=armv8-a+sve" { target aarch64-*-* } } */ + + + +signed char i; + +void +foo (void) +{ + for (i = 0; i < 6; i += 5) + ; +} diff --git a/gcc/tree-ssa-dom.c b/gcc/tree-ssa-dom.c index a5245b33de6..49d8f96408f 100644 --- a/gcc/tree-ssa-dom.c +++ b/gcc/tree-ssa-dom.c @@ -1990,14 +1990,14 @@ dom_opt_dom_walker::optimize_stmt (basic_block bb, gimple_stmt_iterator *si, print_gimple_stmt (dump_file, stmt, 0, TDF_SLIM); } - update_stmt_if_modified (stmt); - opt_stats.num_stmts++; - /* STMT may be a comparison of uniform vectors that we can simplify down to a comparison of scalars. Do that transformation first so that all the scalar optimizations from here onward apply. */ reduce_vector_comparison_to_scalar_comparison (stmt); + update_stmt_if_modified (stmt); + opt_stats.num_stmts++; + /* Const/copy propagate into USES, VUSES and the RHS of VDEFs. */ cprop_into_stmt (stmt, m_evrp_range_analyzer);