[PATCH] D19827: Do not disable completely loop unroll according to optimization level.

Marianne Mailhot-Sarrasin via cfe-commits cfe-commits at lists.llvm.org
Mon May 2 13:15:33 PDT 2016


mamai created this revision.
mamai added a reviewer: chandlerc.
mamai added a subscriber: cfe-commits.
mamai set the repository for this revision to rL LLVM.

By disabling completely the loop unroll at some optimization levels (e.g. /Os), the #pragma unroll have no effect at those optimization levels.

This contradicts the paragraph in an llvm blog post about the loop pragmas (http://blog.llvm.org/2014/11/loop-vectorization-diagnostics-and.html) saying the following:

> For example, when compiling for size (-Os) it's a good idea to vectorize the hot loops of the application to improve performance. Vectorization, interleaving, and unrolling can be explicitly specified using the #pragma clang loop directive prior to any for, while, do-while, or c++11 range-based for loop.

Also, as explained in a previous commit, the  loop unroll pass already have the logic to unroll loop are not according to optimization level (http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20130805/085399.html).

Repository:
  rL LLVM

http://reviews.llvm.org/D19827

Files:
  lib/Frontend/CompilerInvocation.cpp

Index: lib/Frontend/CompilerInvocation.cpp
===================================================================
--- lib/Frontend/CompilerInvocation.cpp
+++ lib/Frontend/CompilerInvocation.cpp
@@ -511,9 +511,7 @@
                             Args.hasArg(OPT_ffreestanding));
   if (Opts.SimplifyLibCalls)
     getAllNoBuiltinFuncValues(Args, Opts.NoBuiltinFuncs);
-  Opts.UnrollLoops =
-      Args.hasFlag(OPT_funroll_loops, OPT_fno_unroll_loops,
-                   (Opts.OptimizationLevel > 1 && !Opts.OptimizeSize));
+  Opts.UnrollLoops = Args.hasFlag(OPT_funroll_loops, OPT_fno_unroll_loops);
   Opts.RerollLoops = Args.hasArg(OPT_freroll_loops);
 
   Opts.DisableIntegratedAS = Args.hasArg(OPT_fno_integrated_as);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D19827.55866.patch
Type: text/x-patch
Size: 717 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160502/77e61d9f/attachment.bin>


More information about the cfe-commits mailing list