[llvm] 8d71a2a - [VPlan] Use ExitBocks to check in VPlan::isExitBlock (NFC).

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Sun Apr 6 01:49:10 PDT 2025


Author: Florian Hahn
Date: 2025-04-06T09:48:52+01:00
New Revision: 8d71a2a905508f32ed201920ef7ac15a3ad8e4e6

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

LOG: [VPlan] Use ExitBocks to check in VPlan::isExitBlock (NFC).

Exit blocks of the VPlan are now hold in ExitBlocks. Use it to check if
a block is an exit block. Otherwise we currently mis-classify the scalar
loop header also as exit block, as it is not explicitly connected to the
exit blocks.

NFC at the moment, as the helper currently is never queried with the
scalar header, but that will change in the future.

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Vectorize/VPlan.cpp b/llvm/lib/Transforms/Vectorize/VPlan.cpp
index 85fd34d79be42..a6e807b616ce5 100644
--- a/llvm/lib/Transforms/Vectorize/VPlan.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlan.cpp
@@ -921,7 +921,7 @@ VPIRBasicBlock *VPlan::getExitBlock(BasicBlock *IRBB) const {
 }
 
 bool VPlan::isExitBlock(VPBlockBase *VPBB) {
-  return isa<VPIRBasicBlock>(VPBB) && VPBB->getNumSuccessors() == 0;
+  return is_contained(ExitBlocks, VPBB);
 }
 
 /// Generate the code inside the preheader and body of the vectorized loop.


        


More information about the llvm-commits mailing list