Skip to content

Commit 20aafa1

Browse files
committed
[VPlan] Create VPIRInstructions for expanded SCEVs.
1 parent caa93e5 commit 20aafa1

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3493,6 +3493,7 @@ VPlanTransforms::expandSCEVs(VPlan &Plan, ScalarEvolution &SE) {
34933493
auto *Entry = cast<VPIRBasicBlock>(Plan.getEntry());
34943494
BasicBlock *EntryBB = Entry->getIRBasicBlock();
34953495
DenseMap<const SCEV *, Value *> ExpandedSCEVs;
3496+
VPBasicBlock::iterator InsertPt;
34963497
for (VPRecipeBase &R : make_early_inc_range(*Entry)) {
34973498
if (isa<VPIRInstruction, VPIRPhi>(&R))
34983499
continue;
@@ -3507,8 +3508,16 @@ VPlanTransforms::expandSCEVs(VPlan &Plan, ScalarEvolution &SE) {
35073508
ExpSCEV->replaceAllUsesWith(Exp);
35083509
if (Plan.getTripCount() == ExpSCEV)
35093510
Plan.resetTripCount(Exp);
3511+
3512+
InsertPt = std::next(ExpSCEV->getIterator());
35103513
ExpSCEV->eraseFromParent();
35113514
}
3515+
for (Instruction &I : *EntryBB) {
3516+
if (!Expander.isInsertedInstruction(&I) || isa<PHINode>(I))
3517+
continue;
3518+
VPIRInstruction::create(I)->insertBefore(*Entry, InsertPt);
3519+
}
3520+
35123521
return ExpandedSCEVs;
35133522
}
35143523

0 commit comments

Comments
 (0)