diff options
author | Reid Spencer <rspencer@reidspencer.com> | 2006-12-13 00:50:17 +0000 |
---|---|---|
committer | Reid Spencer <rspencer@reidspencer.com> | 2006-12-13 00:50:17 +0000 |
commit | 7b06bd532d3324a2f76bbc856ae20ff89d8e0e92 (patch) | |
tree | cbd629912f00b8d9d35e320842aca7e1cded803e /lib/Transforms/Utils/LowerAllocations.cpp | |
parent | 31b628ba6096d2b0bb5591b1231a8e4df4f6c8b8 (diff) |
Replace CastInst::createInferredCast calls with more accurate cast
creation calls.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32521 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Utils/LowerAllocations.cpp')
-rw-r--r-- | lib/Transforms/Utils/LowerAllocations.cpp | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/lib/Transforms/Utils/LowerAllocations.cpp b/lib/Transforms/Utils/LowerAllocations.cpp index d011d75475..30b0ab827e 100644 --- a/lib/Transforms/Utils/LowerAllocations.cpp +++ b/lib/Transforms/Utils/LowerAllocations.cpp @@ -135,7 +135,8 @@ bool LowerAllocations::runOnBasicBlock(BasicBlock &BB) { } else { Value *Scale = MI->getOperand(0); if (Scale->getType() != IntPtrTy) - Scale = CastInst::createInferredCast(Scale, IntPtrTy, "", I); + Scale = CastInst::createIntegerCast(Scale, IntPtrTy, false /*ZExt*/, + "", I); // Multiply it by the array size if necessary... MallocArg = BinaryOperator::create(Instruction::Mul, Scale, @@ -149,13 +150,12 @@ bool LowerAllocations::runOnBasicBlock(BasicBlock &BB) { if (MallocFTy->getNumParams() > 0 || MallocFTy->isVarArg()) { if (MallocFTy->isVarArg()) { if (MallocArg->getType() != IntPtrTy) - MallocArg = CastInst::createInferredCast(MallocArg, IntPtrTy, "", - I); + MallocArg = CastInst::createIntegerCast(MallocArg, IntPtrTy, + false /*ZExt*/, "", I); } else if (MallocFTy->getNumParams() > 0 && MallocFTy->getParamType(0) != Type::UIntTy) - MallocArg = - CastInst::createInferredCast(MallocArg, MallocFTy->getParamType(0), - "",I); + MallocArg = CastInst::createIntegerCast( + MallocArg, MallocFTy->getParamType(0), false/*ZExt*/, "",I); MallocArgs.push_back(MallocArg); } @@ -170,7 +170,7 @@ bool LowerAllocations::runOnBasicBlock(BasicBlock &BB) { // Create a cast instruction to convert to the right type... Value *MCast; if (MCall->getType() != Type::VoidTy) - MCast = CastInst::createInferredCast(MCall, MI->getType(), "", I); + MCast = new BitCastInst(MCall, MI->getType(), "", I); else MCast = Constant::getNullValue(MI->getType()); @@ -187,8 +187,7 @@ bool LowerAllocations::runOnBasicBlock(BasicBlock &BB) { Value *MCast = FI->getOperand(0); if (FreeFTy->getNumParams() > 0 && FreeFTy->getParamType(0) != MCast->getType()) - MCast = CastInst::createInferredCast(MCast, FreeFTy->getParamType(0), - "", I); + MCast = new BitCastInst(MCast, FreeFTy->getParamType(0), "", I); FreeArgs.push_back(MCast); } |