[clang] [llvm] [LLVM][PhaseOrdering] Run CSE after InstCombine has cleaned the result of vectorisation. (PR #120443)

Paul Walker via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 19 02:49:54 PST 2024


================
@@ -1306,6 +1306,10 @@ void PassBuilder::addVectorPasses(OptimizationLevel Level,
   }
   // Cleanup after the loop optimization passes.
   FPM.addPass(InstCombinePass());
+  // InstCombine can create CSE opportunities when it cleans the result of loop
+  // vectorization. They occur when combines use replaceOperand, which happens
+  // most often when combining the boolean operations created by if-conversion.
+  FPM.addPass(EarlyCSEPass());
 
   if (Level.getSpeedupLevel() > 1 && ExtraVectorizerPasses) {
     ExtraFunctionPassManager<ShouldRunExtraVectorPasses> ExtraPasses;
----------------
paulwalker-arm wrote:

Thanks @fhahn.  For my education is `ShouldRunExtraVectorPasses` something LoopVectorize "sets" to highlight the potential need for extra optimisations?

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


More information about the llvm-commits mailing list