1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 20:51:52 +01:00

[SimplifyLibCalls] Erase replaced instructions

After RAUWing an instruction, also erase it. This makes sure we
don't perform extra InstCombine iterations to clean up the garbage.
This commit is contained in:
Nikita Popov 2020-03-29 19:10:19 +02:00
parent fba73700fd
commit 6583fd399c

View File

@ -832,6 +832,7 @@ Value *LibCallSimplifier::optimizeStrStr(CallInst *CI, IRBuilderBase &B) {
B.CreateICmp(Old->getPredicate(), StrNCmp,
ConstantInt::getNullValue(StrNCmp->getType()), "cmp");
replaceAllUsesWith(Old, Cmp);
eraseFromParent(Old);
}
return CI;
}
@ -2170,8 +2171,10 @@ Value *LibCallSimplifier::optimizeSinCosPi(CallInst *CI, IRBuilderBase &B) {
auto replaceTrigInsts = [this](SmallVectorImpl<CallInst *> &Calls,
Value *Res) {
for (CallInst *C : Calls)
for (CallInst *C : Calls) {
replaceAllUsesWith(C, Res);
eraseFromParent(C);
}
};
replaceTrigInsts(SinCalls, Sin);