Skip to content

Commit 70966f7

Browse files
committed
postpone the removing dead reverse operations
1 parent f5a812f commit 70966f7

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2172,6 +2172,8 @@ static VPRecipeBase *optimizeMaskToEVL(VPValue *HeaderMask,
21722172

21732173
static void convertToEVLReverse(VPlan &Plan, VPTypeAnalysis &TypeInfo,
21742174
VPValue &AllOneMask, VPValue &EVL) {
2175+
SmallVector<VPRecipeBase *> ToRemove;
2176+
21752177
for (VPBasicBlock *VPBB : VPBlockUtils::blocksOnly<VPBasicBlock>(
21762178
vp_depth_first_shallow(Plan.getVectorLoopRegion()->getEntry()))) {
21772179
for (VPRecipeBase &R : make_early_inc_range(reverse(*VPBB))) {
@@ -2186,9 +2188,12 @@ static void convertToEVLReverse(VPlan &Plan, VPTypeAnalysis &TypeInfo,
21862188
TypeInfo.inferScalarType(VPI), VPI->getDebugLoc());
21872189
NewReverse->insertBefore(VPI);
21882190
VPI->replaceAllUsesWith(NewReverse);
2189-
VPI->eraseFromParent();
2191+
ToRemove.push_back(VPI);
21902192
}
21912193
}
2194+
2195+
for (VPRecipeBase *R : ToRemove)
2196+
R->eraseFromParent();
21922197
}
21932198

21942199
/// Replace recipes with their EVL variants.

0 commit comments

Comments
 (0)