make instcombine produce calls to llvm.donothing instead of a random intrinsic

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159384 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Nuno Lopes 2012-06-28 22:31:24 +00:00
parent 85b408991a
commit c363c74c45
2 changed files with 5 additions and 8 deletions

View File

@ -1169,14 +1169,11 @@ Instruction *InstCombiner::visitMalloc(Instruction &MI) {
}
if (InvokeInst *II = dyn_cast<InvokeInst>(&MI)) {
// Replace invoke with a NOOP intrinsic to maintain the original CFG
// Replace invoke with a NOP intrinsic to maintain the original CFG
Module *M = II->getParent()->getParent()->getParent();
IntegerType *Ty = IntegerType::get(II->getContext(), 8);
ConstantInt *CI = ConstantInt::get(Ty, 0);
Value *Args[] = {CI, CI};
Function *F = Intrinsic::getDeclaration(M, Intrinsic::expect, Ty);
InvokeInst::Create(F, II->getNormalDest(), II->getUnwindDest(), Args,
"dummy", II->getParent());
Function *F = Intrinsic::getDeclaration(M, Intrinsic::donothing);
InvokeInst::Create(F, II->getNormalDest(), II->getUnwindDest(),
ArrayRef<Value *>(), "", II->getParent());
}
return EraseInstFromFunction(MI);
}

View File

@ -19,7 +19,7 @@ define i64 @f1() {
; CHECK: @f2
define i64 @f2() nounwind uwtable ssp {
entry:
; CHECK: invoke i8 @llvm.expect.i8(i8 0, i8 0)
; CHECK: invoke void @llvm.donothing()
%call = invoke noalias i8* @_Znwm(i64 13)
to label %invoke.cont unwind label %lpad