1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 10:42:39 +01:00

Revert "[SimplifyLibCalls] Erase replaced instructions"

This reverts commit 2a77544ad5911a38f81c0300385033fced1cc66d. This
introduces a use-after-free in Transforms/InstCombine/sincospi.ll.
Found by asan.
This commit is contained in:
Benjamin Kramer 2020-04-02 17:30:47 +02:00
parent cf3e3f7a6f
commit 11841a12af

View File

@ -832,7 +832,6 @@ Value *LibCallSimplifier::optimizeStrStr(CallInst *CI, IRBuilderBase &B) {
B.CreateICmp(Old->getPredicate(), StrNCmp,
ConstantInt::getNullValue(StrNCmp->getType()), "cmp");
replaceAllUsesWith(Old, Cmp);
eraseFromParent(Old);
}
return CI;
}
@ -2171,10 +2170,8 @@ 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);