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:
parent
fba73700fd
commit
6583fd399c
@ -832,6 +832,7 @@ Value *LibCallSimplifier::optimizeStrStr(CallInst *CI, IRBuilderBase &B) {
|
|||||||
B.CreateICmp(Old->getPredicate(), StrNCmp,
|
B.CreateICmp(Old->getPredicate(), StrNCmp,
|
||||||
ConstantInt::getNullValue(StrNCmp->getType()), "cmp");
|
ConstantInt::getNullValue(StrNCmp->getType()), "cmp");
|
||||||
replaceAllUsesWith(Old, Cmp);
|
replaceAllUsesWith(Old, Cmp);
|
||||||
|
eraseFromParent(Old);
|
||||||
}
|
}
|
||||||
return CI;
|
return CI;
|
||||||
}
|
}
|
||||||
@ -2170,8 +2171,10 @@ Value *LibCallSimplifier::optimizeSinCosPi(CallInst *CI, IRBuilderBase &B) {
|
|||||||
|
|
||||||
auto replaceTrigInsts = [this](SmallVectorImpl<CallInst *> &Calls,
|
auto replaceTrigInsts = [this](SmallVectorImpl<CallInst *> &Calls,
|
||||||
Value *Res) {
|
Value *Res) {
|
||||||
for (CallInst *C : Calls)
|
for (CallInst *C : Calls) {
|
||||||
replaceAllUsesWith(C, Res);
|
replaceAllUsesWith(C, Res);
|
||||||
|
eraseFromParent(C);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
replaceTrigInsts(SinCalls, Sin);
|
replaceTrigInsts(SinCalls, Sin);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user