[llvm] [VPlan] Introduce explicit ExtractFromEnd recipes for live-outs. (PR #100658)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 21 02:25:52 PDT 2024
================
@@ -8578,21 +8616,31 @@ static void addLiveOutsForFirstOrderRecurrences(VPlan &Plan) {
// TODO: Should be replaced by
// Plan->getScalarLoopRegion()->getSinglePredecessor() in the future once the
// scalar region is modeled as well.
- VPBasicBlock *ScalarPHVPBB = nullptr;
auto *MiddleVPBB = cast<VPBasicBlock>(VectorRegion->getSingleSuccessor());
- for (VPBlockBase *Succ : MiddleVPBB->getSuccessors()) {
- if (isa<VPIRBasicBlock>(Succ))
- continue;
- assert(!ScalarPHVPBB && "Two candidates for ScalarPHVPBB?");
- ScalarPHVPBB = cast<VPBasicBlock>(Succ);
+ BasicBlock *ExitBB = nullptr;
+ VPBasicBlock *ScalarPHVPBB = nullptr;
+ if (MiddleVPBB->getNumSuccessors() == 2) {
+ // Order is strict: first is the exit block, second is the scalar preheader.
+ ExitBB =
+ cast<VPIRBasicBlock>(MiddleVPBB->getSuccessors()[0])->getIRBasicBlock();
+ ScalarPHVPBB = cast<VPBasicBlock>(MiddleVPBB->getSuccessors()[1]);
+ } else if (ExitingValuesToFix.empty()) {
+ ScalarPHVPBB = cast<VPBasicBlock>(MiddleVPBB->getSingleSuccessor());
+ } else {
+ ExitBB = cast<VPIRBasicBlock>(MiddleVPBB->getSingleSuccessor())
+ ->getIRBasicBlock();
}
- if (!ScalarPHVPBB)
+ if (!ScalarPHVPBB) {
+ assert(ExitingValuesToFix.empty() &&
+ "missed inserting extracts for exiting values");
return;
+ }
----------------
ayalz wrote:
Can ScalarPHVPBB be null?
https://github.com/llvm/llvm-project/pull/100658
More information about the llvm-commits
mailing list