[llvm] [VPlan] Add initial CFG simplification, removing BranchOnCond true. (PR #106748)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 2 04:14:06 PDT 2025


================
@@ -7570,10 +7574,10 @@ VectorizationFactor LoopVectorizationPlanner::computeBestVF() {
   // Set PlanForEarlyExitLoop to true if the BestPlan has been built from a
   // loop with an uncountable early exit. The legacy cost model doesn't
   // properly model costs for such loops.
+  auto ExitBlocks = BestPlan.getExitBlocks();
   bool PlanForEarlyExitLoop =
-      BestPlan.getVectorLoopRegion() &&
-      BestPlan.getVectorLoopRegion()->getSingleSuccessor() !=
-          BestPlan.getMiddleBlock();
+      ExitBlocks.size() > 1 ||
+      (ExitBlocks.size() == 1 && ExitBlocks[0]->getNumPredecessors() > 1);
----------------
fhahn wrote:

I removed the changes, they are not needed in the latest version. I can put them up separately, as this might be slightly simpler than having to retrieve middle block and vector loop region.

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


More information about the llvm-commits mailing list