forked from OSchip/llvm-project
Revert "[SimplifyLibCalls] Erase replaced instructions"
This reverts commit 2a77544ad5
. This
introduces a use-after-free in Transforms/InstCombine/sincospi.ll.
Found by asan.
This commit is contained in:
parent
bacade1ddf
commit
dffc503187
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue