From: Richard Biener Date: Tue, 7 Jan 2025 12:18:27 +0000 (+0100) Subject: rtl-optimization/118298 - constant iteration loops and #pragma unroll X-Git-Tag: basepoints/gcc-16~2901 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=34501ef418da13b361614235077c2162caabab73;p=thirdparty%2Fgcc.git rtl-optimization/118298 - constant iteration loops and #pragma unroll When the RTL unroller handles constant iteration loops it bails out prematurely when heuristics wouldn't apply any unrolling before checking #pragma unroll. PR rtl-optimization/118298 * loop-unroll.cc (decide_unroll_constant_iterations): Honor loop->unroll even if the loop is too big for heuristics. --- diff --git a/gcc/loop-unroll.cc b/gcc/loop-unroll.cc index 2bd6e888b266..b49520553182 100644 --- a/gcc/loop-unroll.cc +++ b/gcc/loop-unroll.cc @@ -372,7 +372,8 @@ decide_unroll_constant_iterations (class loop *loop, int flags) nunroll = targetm.loop_unroll_adjust (nunroll, loop); /* Skip big loops. */ - if (nunroll <= 1) + if (nunroll <= 1 + && !(loop->unroll > 1 && loop->unroll < USHRT_MAX)) { if (dump_file) fprintf (dump_file, ";; Not considering loop, is too big\n");