[llvm] e165225 - [VPlan] Simplify check in collectUsersInLatchExitBlock. (NFC)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Mon May 5 11:14:56 PDT 2025


Author: Florian Hahn
Date: 2025-05-05T19:14:37+01:00
New Revision: e165225e49f71b468a35ca15c7ae397471cbfef0

URL: https://github.com/llvm/llvm-project/commit/e165225e49f71b468a35ca15c7ae397471cbfef0
DIFF: https://github.com/llvm/llvm-project/commit/e165225e49f71b468a35ca15c7ae397471cbfef0.diff

LOG: [VPlan] Simplify check in collectUsersInLatchExitBlock. (NFC)

Unswitch the check in collectUsersInLatchExitBlock as suggested in
https://github.com/llvm/llvm-project/pull/136455.

The assertion is now checked by the verifier since aadf35cb41d.

Added: 
    

Modified: 
    llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
index 2682be5866122..2dca2b322ee82 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -9193,15 +9193,12 @@ static void addScalarResumePhis(VPRecipeBuilder &Builder, VPlan &Plan,
 static SetVector<VPIRInstruction *> collectUsersInLatchExitBlock(VPlan &Plan) {
   SetVector<VPIRInstruction *> ExitUsersToFix;
   for (VPIRBasicBlock *ExitVPBB : Plan.getExitBlocks()) {
+
+    if (ExitVPBB->getSinglePredecessor() != Plan.getMiddleBlock())
+      continue;
+
     for (VPRecipeBase &R : ExitVPBB->phis()) {
       auto *ExitIRI = cast<VPIRPhi>(&R);
-      if (ExitVPBB->getSinglePredecessor() != Plan.getMiddleBlock()) {
-        assert(ExitIRI->getNumOperands() ==
-                   ExitVPBB->getPredecessors().size() &&
-               "early-exit must update exit values on construction");
-        continue;
-      }
-
       assert(ExitIRI->getNumOperands() == 1 && "must have a single operand");
       VPValue *V = ExitIRI->getOperand(0);
       if (V->isLiveIn())


        


More information about the llvm-commits mailing list