OSDN Git Service

make instcombine produce calls to llvm.donothing instead of a random intrinsic
authorNuno Lopes <nunoplopes@sapo.pt>
Thu, 28 Jun 2012 22:31:24 +0000 (22:31 +0000)
committerNuno Lopes <nunoplopes@sapo.pt>
Thu, 28 Jun 2012 22:31:24 +0000 (22:31 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159384 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/InstCombine/InstructionCombining.cpp
test/Transforms/InstCombine/objsize-64.ll

index 07793ac..c5124bf 100644 (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);
   }
index 7a39f46..4993063 100644 (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