Skip to content

Commit 19df7fa

Browse files
committed
[InstCombine] Erase old alloca in cast of alloca transform
As we don't return the replaceInstUsesWith() result, we are responsible for erasing the instruction. NFC apart from worklist order.
1 parent 8735780 commit 19df7fa

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ Instruction *InstCombiner::PromoteCastOfAllocation(BitCastInst &CI,
153153
// allocation instruction, also pointer typed. Thus, cast to use is BitCast.
154154
Value *NewCast = Builder.CreateBitCast(New, AI.getType(), "tmpcast");
155155
replaceInstUsesWith(AI, NewCast);
156+
eraseInstFromFunction(AI);
156157
}
157158
return replaceInstUsesWith(CI, New);
158159
}

0 commit comments

Comments
 (0)