Skip to content

Commit 0ac83f1

Browse files
committed
Remove dead alloc_ref after deleting allocating apply
1 parent baebc7d commit 0ac83f1

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/SILOptimizer/Transforms/DeadObjectElimination.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1170,11 +1170,17 @@ bool DeadObjectElimination::processAllocApply(ApplyInst *AI,
11701170

11711171
LLVM_DEBUG(llvm::dbgs() << " Success! Eliminating apply allocate(...).\n");
11721172

1173+
auto *ARI = dyn_cast<AllocRefInst>(AI->getArgument(0));
1174+
11731175
deleter.forceDeleteWithUsers(AI);
11741176
for (auto *toDelete : instsDeadAfterInitializerRemoved) {
11751177
deleter.trackIfDead(toDelete);
11761178
}
11771179

1180+
if (ARI) {
1181+
deleter.forceDeleteWithUsers(ARI);
1182+
}
1183+
11781184
++DeadAllocApplyEliminated;
11791185
return true;
11801186
}

0 commit comments

Comments
 (0)