Hi I was fiddling around with the loop unrolling pass and noticed a check in decide_unroll_* functions (in the patch). The comment on top of this check says "/* If we were not asked to unroll this loop, just return back silently. */" However the check returns when loop->unroll == 0 rather than 1.
The check was added in r255106 where the ChangeLog suggests that the actual intention was probably to check the value 1 and not 0. Tested on aarch64-none-elf with one new regression: FAIL: gcc.dg/pr40209.c (test for excess errors) This fails because the changes cause the loop to unroll 3 times using unroll_stupid and that shows up as excess error due -fopt-info. This option was added in r202077 but I am not sure why this particular test was chosen for it. Does this change look ok? Can I just remove the -fopt-info from the test or unrolling the loop in the test is not desirable? Thanks Sudi gcc/ChangeLog: 2019-11-07 Sudakshina Das <sudi....@arm.com> * loop-unroll.c (decide_unroll_constant_iterations): Update condition to check loop->unroll. (decide_unroll_runtime_iterations): Likewise. (decide_unroll_stupid): Likewise.
diff --git a/gcc/loop-unroll.c b/gcc/loop-unroll.c index 63fccd23fae38f8918a7d94411aaa43c72830dd3..9f7ab4b5c1c9b2333148e452b84afbf040707456 100644 --- a/gcc/loop-unroll.c +++ b/gcc/loop-unroll.c @@ -354,7 +354,7 @@ decide_unroll_constant_iterations (class loop *loop, int flags) widest_int iterations; /* If we were not asked to unroll this loop, just return back silently. */ - if (!(flags & UAP_UNROLL) && !loop->unroll) + if (!(flags & UAP_UNROLL) && loop->unroll == 1) return; if (dump_enabled_p ()) @@ -674,7 +674,7 @@ decide_unroll_runtime_iterations (class loop *loop, int flags) widest_int iterations; /* If we were not asked to unroll this loop, just return back silently. */ - if (!(flags & UAP_UNROLL) && !loop->unroll) + if (!(flags & UAP_UNROLL) && loop->unroll == 1) return; if (dump_enabled_p ()) @@ -1159,7 +1159,7 @@ decide_unroll_stupid (class loop *loop, int flags) widest_int iterations; /* If we were not asked to unroll this loop, just return back silently. */ - if (!(flags & UAP_UNROLL_ALL) && !loop->unroll) + if (!(flags & UAP_UNROLL_ALL) && loop->unroll == 1) return; if (dump_enabled_p ())