[llvm] 7c4ef67 - [VPlan] Update hasEarlyExit check to consider no-exit block case

Anna Thomas via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 11 06:11:02 PDT 2025


Author: Anna Thomas
Date: 2025-07-11T09:10:26-04:00
New Revision: 7c4ef6708ae4fbf898ae416fe151b8cf2bdec297

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

LOG: [VPlan] Update hasEarlyExit check to consider no-exit block case

If we call this API during vectorization without any exit blocks, we
need to first check there is atleast one exit block.

PR: https://github.com/llvm/llvm-project/pull/145730

Added: 
    

Modified: 
    llvm/lib/Transforms/Vectorize/VPlan.h

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Vectorize/VPlan.h b/llvm/lib/Transforms/Vectorize/VPlan.h
index 9a6e4b36397b3..85741b977bb77 100644
--- a/llvm/lib/Transforms/Vectorize/VPlan.h
+++ b/llvm/lib/Transforms/Vectorize/VPlan.h
@@ -4183,7 +4183,8 @@ class VPlan {
   /// block with multiple predecessors (one for the exit via the latch and one
   /// via the other early exit).
   bool hasEarlyExit() const {
-    return ExitBlocks.size() > 1 || ExitBlocks[0]->getNumPredecessors() > 1;
+    return ExitBlocks.size() > 1 ||
+           (ExitBlocks.size() == 1 && ExitBlocks[0]->getNumPredecessors() > 1);
   }
 
   /// Returns true if the scalar tail may execute after the vector loop. Note


        


More information about the llvm-commits mailing list