From 8a903db4990d57aadea5cdad601ff26e92899103 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32654 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/IntrinsicLowering.cpp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'lib/CodeGen') diff --git a/lib/CodeGen/IntrinsicLowering.cpp b/lib/CodeGen/IntrinsicLowering.cpp index f18d5f9a4f..b57b27252f 100644 --- a/lib/CodeGen/IntrinsicLowering.cpp +++ b/lib/CodeGen/IntrinsicLowering.cpp @@ -66,9 +66,13 @@ static CallInst *ReplaceCallWith(const char *NewFn, CallInst *CI, if (castOpcodes[ArgNo]) Arg = CastInst::create(Instruction::CastOps(castOpcodes[ArgNo]), Arg, FT->getParamType(ArgNo), Arg->getName(), CI); - else - Arg = CastInst::createInferredCast(Arg, FT->getParamType(ArgNo), - Arg->getName(), CI); + else { + Instruction::CastOps opcode = CastInst::getCastOpcode(Arg, + Arg->getType()->isSigned(), FT->getParamType(ArgNo), + FT->getParamType(ArgNo)->isSigned()); + Arg = CastInst::create(opcode, Arg, FT->getParamType(ArgNo), + Arg->getName(), CI); + } Operands.push_back(Arg); } // Pass nulls into any additional arguments... @@ -80,8 +84,12 @@ static CallInst *ReplaceCallWith(const char *NewFn, CallInst *CI, CallInst *NewCI = new CallInst(FCache, Operands, Name, CI); if (!CI->use_empty()) { Value *V = NewCI; - if (CI->getType() != NewCI->getType()) - V = CastInst::createInferredCast(NewCI, CI->getType(), Name, CI); + if (CI->getType() != NewCI->getType()) { + Instruction::CastOps opcode = CastInst::getCastOpcode(NewCI, + NewCI->getType()->isSigned(), CI->getType(), + CI->getType()->isSigned()); + V = CastInst::create(opcode, NewCI, CI->getType(), Name, CI); + } CI->replaceAllUsesWith(V); } return NewCI; -- cgit v1.2.3-70-g09d2