[llvm] [VPlan] Hook IR blocks into VPlan during skeleton creation (NFC) (PR #114292)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 13 15:43:58 PST 2024
================
@@ -1276,6 +1287,19 @@ VPlan *VPlan::duplicate() {
return NewPlan;
}
+VPBasicBlock *VPlan::getScalarPreheader() {
+ auto *MiddleVPBB =
+ cast<VPBasicBlock>(getVectorLoopRegion()->getSingleSuccessor());
+ if (MiddleVPBB->getNumSuccessors() == 2) {
+ // Order is strict: first is the exit block, second is the scalar preheader.
+ return cast<VPBasicBlock>(MiddleVPBB->getSuccessors()[1]);
+ }
+ if (auto *IRVPBB = dyn_cast<VPBasicBlock>(MiddleVPBB->getSingleSuccessor()))
----------------
ayalz wrote:
dyn_casting to VPBB but calling it `IRVPBB`?
Intention is to return the single successor if it's not an IRVPBB, as that represents the exit block?
```suggestion
if (isa<VPIRBasicBlock>(MiddleVPBB->getSingleSuccessor())) {
// Exit block is IRVPBB, scalar preheader is not.
return nullptr;
}
return cast<VPBasicBlock>(MiddleVPBB->getSingleSuccessor());
```
https://github.com/llvm/llvm-project/pull/114292
More information about the llvm-commits
mailing list