From 668d90f2892ed5700faa78951c5686923f2a9d6e Mon Sep 17 00:00:00 2001 From: Reid Spencer Date: Mon, 18 Dec 2006 08:47:13 +0000 Subject: Convert the last uses of CastInst::createInferredCast to a normal cast creation. These changes are still temporary but at least this pushes knowledge of signedness out closer to where it can be determined properly and allows signedness to be removed from VMCore. llvm-svn: 32654 --- llvm/lib/Transforms/Instrumentation/ProfilingUtils.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'llvm/lib/Transforms/Instrumentation/ProfilingUtils.cpp') diff --git a/llvm/lib/Transforms/Instrumentation/ProfilingUtils.cpp b/llvm/lib/Transforms/Instrumentation/ProfilingUtils.cpp index 274275a689b..4adf09e0999 100644 --- a/llvm/lib/Transforms/Instrumentation/ProfilingUtils.cpp +++ b/llvm/lib/Transforms/Instrumentation/ProfilingUtils.cpp @@ -62,8 +62,10 @@ void llvm::InsertProfilingInitCall(Function *MainFn, const char *FnName, case 2: AI = MainFn->arg_begin(); ++AI; if (AI->getType() != ArgVTy) { + Instruction::CastOps opcode = CastInst::getCastOpcode(AI, + AI->getType()->isSigned(), ArgVTy, ArgVTy->isSigned()); InitCall->setOperand(2, - CastInst::createInferredCast(AI, ArgVTy, "argv.cast", InitCall)); + CastInst::create(opcode, AI, ArgVTy, "argv.cast", InitCall)); } else { InitCall->setOperand(2, AI); } @@ -74,11 +76,18 @@ void llvm::InsertProfilingInitCall(Function *MainFn, const char *FnName, // If the program looked at argc, have it look at the return value of the // init call instead. if (AI->getType() != Type::IntTy) { - if (!AI->use_empty()) + Instruction::CastOps opcode; + if (!AI->use_empty()) { + opcode = CastInst::getCastOpcode(InitCall, + InitCall->getType()->isSigned(), AI->getType(), + AI->getType()->isSigned()); AI->replaceAllUsesWith( - CastInst::createInferredCast(InitCall, AI->getType(), "", InsertPos)); + CastInst::create(opcode, InitCall, AI->getType(), "", InsertPos)); + } + opcode = CastInst::getCastOpcode(AI, AI->getType()->isSigned(), + Type::IntTy, true); InitCall->setOperand(1, - CastInst::createInferredCast(AI, Type::IntTy, "argc.cast", InitCall)); + CastInst::create(opcode, AI, Type::IntTy, "argc.cast", InitCall)); } else { AI->replaceAllUsesWith(InitCall); InitCall->setOperand(1, AI); -- cgit v1.2.3