[PATCH] D61618: [NewPassManager] Add tuning option: LoopUnrolling [NFC].

Alina Sbirlea via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 23 12:37:24 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL361540: [NewPassManager] Add tuning option: LoopUnrolling [NFC]. (authored by asbirlea, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D61618?vs=198362&id=201039#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D61618/new/

https://reviews.llvm.org/D61618

Files:
  llvm/trunk/include/llvm/Passes/PassBuilder.h
  llvm/trunk/lib/Passes/PassBuilder.cpp


Index: llvm/trunk/lib/Passes/PassBuilder.cpp
===================================================================
--- llvm/trunk/lib/Passes/PassBuilder.cpp
+++ llvm/trunk/lib/Passes/PassBuilder.cpp
@@ -217,6 +217,7 @@
   LoopInterleaving = EnableLoopInterleaving;
   LoopVectorization = EnableLoopVectorization;
   SLPVectorization = RunSLPVectorization;
+  LoopUnrolling = true;
   LicmMssaOptCap = SetLicmMssaOptCap;
   LicmMssaNoAccForPromotionCap = SetLicmMssaNoAccForPromotionCap;
 }
@@ -459,8 +460,9 @@
   // Do not enable unrolling in PreLinkThinLTO phase during sample PGO
   // because it changes IR to makes profile annotation in back compile
   // inaccurate.
-  if (Phase != ThinLTOPhase::PreLink || !PGOOpt ||
-      PGOOpt->Action != PGOOptions::SampleUse)
+  if ((Phase != ThinLTOPhase::PreLink || !PGOOpt ||
+       PGOOpt->Action != PGOOptions::SampleUse) &&
+      PTO.LoopUnrolling)
     LPM2.addPass(LoopFullUnrollPass(Level));
 
   for (auto &C : LoopOptimizerEndEPCallbacks)
@@ -907,7 +909,8 @@
     OptimizePM.addPass(
         createFunctionToLoopPassAdaptor(LoopUnrollAndJamPass(Level)));
   }
-  OptimizePM.addPass(LoopUnrollPass(LoopUnrollOptions(Level)));
+  if (PTO.LoopUnrolling)
+    OptimizePM.addPass(LoopUnrollPass(LoopUnrollOptions(Level)));
   OptimizePM.addPass(WarnMissedTransformationsPass());
   OptimizePM.addPass(InstCombinePass());
   OptimizePM.addPass(RequireAnalysisPass<OptimizationRemarkEmitterAnalysis, Function>());
Index: llvm/trunk/include/llvm/Passes/PassBuilder.h
===================================================================
--- llvm/trunk/include/llvm/Passes/PassBuilder.h
+++ llvm/trunk/include/llvm/Passes/PassBuilder.h
@@ -85,6 +85,9 @@
   /// is that of the flag: `vectorize-slp`.
   bool SLPVectorization;
 
+  /// Tuning option to enable/disable loop unrolling. Its default value is true.
+  bool LoopUnrolling;
+
   /// Tuning option to cap the number of calls to retrive clobbering accesses in
   /// MemorySSA, in LICM.
   unsigned LicmMssaOptCap;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D61618.201039.patch
Type: text/x-patch
Size: 2018 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190523/f7918292/attachment.bin>


More information about the llvm-commits mailing list