[llvm] [VPlan] Introduce explicit ExtractFromEnd recipes for live-outs. (PR #100658)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 29 10:42:04 PDT 2024
================
@@ -8452,7 +8452,104 @@ static void addUsersInExitBlock(
return P && Inductions.contains(P);
})))
continue;
- Plan.addLiveOut(&ExitPhi, V);
+
+ auto MiddleVPBB =
+ cast<VPBasicBlock>(Plan.getVectorLoopRegion()->getSingleSuccessor());
+ VPBuilder B(MiddleVPBB);
+ if (auto *Terminator = MiddleVPBB->getTerminator()) {
+ auto *Condition = dyn_cast<VPInstruction>(Terminator->getOperand(0));
+ assert((!Condition || Condition->getParent() == MiddleVPBB) &&
+ "Condition expected in MiddleVPBB");
+ B.setInsertPoint(Condition ? Condition : Terminator);
+ }
+
+ VPValue *Ext;
+ if (auto *FOR = dyn_cast_or_null<VPFirstOrderRecurrencePHIRecipe>(
+ V->getDefiningRecipe())) {
+ // This is the second phase of vectorizing first-order recurrences. An
+ // overview of the transformation is described below. Suppose we have the
+ // following loop with some use after the loop of the last a[i-1],
----------------
ayalz wrote:
This explanation is moved from adjustFixedOrderRecurrences() to here (addUsersInExitBlock()), yet deserves to still be in a method dedicated to (the 2nd phase of) FORs. How about moving it, along with setting the users of FOR in exit block, to addLiveOutsForFixedOrderRecurrences()?
The documentation of these methods may need updating, once settled.
https://github.com/llvm/llvm-project/pull/100658
More information about the llvm-commits
mailing list