]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
rtl-optimization/118298 - constant iteration loops and #pragma unroll
authorRichard Biener <rguenther@suse.de>
Tue, 7 Jan 2025 12:18:27 +0000 (13:18 +0100)
committerRichard Biener <rguenth@gcc.gnu.org>
Tue, 7 Jan 2025 14:33:58 +0000 (15:33 +0100)
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.

gcc/loop-unroll.cc

index 2bd6e888b266c09aeb5522c27f288ff78783fad5..b49520553182397cbe787ecf065eeeb3b082cd3a 100644 (file)
@@ -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");