diff --git a/llvm/lib/Transforms/Utils/LowerExpectIntrinsic.cpp b/llvm/lib/Transforms/Utils/LowerExpectIntrinsic.cpp index fd94c84413ba..563f7f4490a3 100644 --- a/llvm/lib/Transforms/Utils/LowerExpectIntrinsic.cpp +++ b/llvm/lib/Transforms/Utils/LowerExpectIntrinsic.cpp @@ -145,8 +145,11 @@ bool LowerExpectIntrinsic::runOnFunction(Function &F) { continue; Function *Fn = CI->getCalledFunction(); - if (Fn && Fn->getIntrinsicID() == Intrinsic::expect) + if (Fn && Fn->getIntrinsicID() == Intrinsic::expect) { + Value *Exp = CI->getArgOperand(0); + CI->replaceAllUsesWith(Exp); CI->eraseFromParent(); + } } }