[llvm] [VPlan] Model FOR extract of exit value in VPlan. (PR #93395)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 3 06:29:34 PDT 2024
================
@@ -831,18 +833,28 @@ bool VPlanTransforms::adjustFixedOrderRecurrences(VPlan &Plan,
// fixed-order recurrence.
VPBasicBlock *InsertBlock = Previous->getParent();
if (isa<VPHeaderPHIRecipe>(Previous))
- Builder.setInsertPoint(InsertBlock, InsertBlock->getFirstNonPhi());
+ LoopBuilder.setInsertPoint(InsertBlock, InsertBlock->getFirstNonPhi());
else
- Builder.setInsertPoint(InsertBlock, std::next(Previous->getIterator()));
+ LoopBuilder.setInsertPoint(InsertBlock,
+ std::next(Previous->getIterator()));
auto *RecurSplice = cast<VPInstruction>(
- Builder.createNaryOp(VPInstruction::FirstOrderRecurrenceSplice,
- {FOR, FOR->getBackedgeValue()}));
+ LoopBuilder.createNaryOp(VPInstruction::FirstOrderRecurrenceSplice,
+ {FOR, FOR->getBackedgeValue()}));
FOR->replaceAllUsesWith(RecurSplice);
// Set the first operand of RecurSplice to FOR again, after replacing
// all users.
RecurSplice->setOperand(0, FOR);
+
+ Type *IntTy = Plan.getCanonicalIV()->getScalarType();
+ auto *Result = cast<VPInstruction>(MiddleBuilder.createNaryOp(
+ VPInstruction::ExtractFromEnd,
+ {FOR->getBackedgeValue(),
+ Plan.getOrAddLiveIn(ConstantInt::get(IntTy, 2))},
+ {}, "vector.recur.extract.for.phi"));
----------------
ayalz wrote:
ok, this is the unique Name assigned to this VPInstruction instance.
https://github.com/llvm/llvm-project/pull/93395
More information about the llvm-commits
mailing list