[clang] [llvm] [LLVM][PhaseOrdering] Run CSE after InstCombine has cleaned the result of vectorisation. (PR #120443)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 18 13:06:35 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;
----------------
fhahn wrote:
```suggestion
// 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.
ExtraFunctionPassManager<ShouldRunExtraVectorPasses> ExtraPasses;
ExtraPasses.addPass(EarlyCSEPass());
if (Level.getSpeedupLevel() > 1 && ExtraVectorizerPasses) {
ExtraFunctionPassManager<ShouldRunExtraVectorPasses> ExtraPasses;
....
}
FPM.addPass(std::move(ExtraPasses));
```
Would probably help to soften the compile-time blow a bit
https://github.com/llvm/llvm-project/pull/120443
More information about the llvm-commits
mailing list