[llvm] Swap UnrollAndJam Pass to before the SLP Vectorizer Pass (PR #97029)

Yashwant Singh via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 3 22:24:16 PDT 2024


================
@@ -1306,6 +1307,12 @@ void PassBuilder::addVectorPasses(OptimizationLevel Level,
     FPM.addPass(BDCEPass());
   }
 
+  // We do UnrollAndJam in a separate LPM to Unroll ensure it happens first.
+  // In order for outer loop vectorization to be done, UnrollAndJam must occur before the SLPVectorizerPass.
+  if (EnableUnrollAndJam && PTO.LoopUnrolling) {
+    FPM.addPass(createFunctionToLoopPassAdaptor(
+        LoopUnrollAndJamPass(Level.getSpeedupLevel())));
+  }
   // Optimize parallel scalar instruction chains into SIMD instructions.
   if (PTO.SLPVectorization) {
----------------
yashssh wrote:

Is SLP vectorization on be default? If not then instead of moving UnJ, running another instance of the pass under this condition can be explored to avoid compile time penalties?

https://github.com/llvm/llvm-project/pull/97029


More information about the llvm-commits mailing list