diff --git a/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp b/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp index b6acde9bdd110..df5f9833a2ff9 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp @@ -2067,8 +2067,7 @@ convertFSqrtDivIntoFMul(CallInst *CI, Instruction *X, FMul->copyMetadata(*X); FMul->copyFastMathFlags(FastMathFlags::intersectRewrite(R1FMF, R2FMF) | FastMathFlags::unionValue(R1FMF, R2FMF)); - IC->replaceInstUsesWith(*X, FMul); - return IC->eraseInstFromFunction(*X); + return IC->replaceInstUsesWith(*X, FMul); } Instruction *InstCombinerImpl::visitFDiv(BinaryOperator &I) {