[llvm-commits] CVS: llvm/lib/Transforms/Utils/LowerAllocations.cpp
Reid Spencer
reid at x10sys.com
Tue Dec 12 16:50:43 PST 2006
Changes in directory llvm/lib/Transforms/Utils:
LowerAllocations.cpp updated: 1.66 -> 1.67
---
Log message:
Replace CastInst::createInferredCast calls with more accurate cast
creation calls.
---
Diffs of the changes: (+8 -9)
LowerAllocations.cpp | 17 ++++++++---------
1 files changed, 8 insertions(+), 9 deletions(-)
Index: llvm/lib/Transforms/Utils/LowerAllocations.cpp
diff -u llvm/lib/Transforms/Utils/LowerAllocations.cpp:1.66 llvm/lib/Transforms/Utils/LowerAllocations.cpp:1.67
--- llvm/lib/Transforms/Utils/LowerAllocations.cpp:1.66 Tue Dec 12 03:17:08 2006
+++ llvm/lib/Transforms/Utils/LowerAllocations.cpp Tue Dec 12 18:50:17 2006
@@ -135,7 +135,8 @@
} 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 @@
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 @@
// 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 @@
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);
}
More information about the llvm-commits
mailing list