================
@@ -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
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to