[llvm-commits] CVS: llvm/lib/Transforms/Utils/LowerAllocations.cpp LowerInvoke.cpp
Chris Lattner
clattner at apple.com
Mon Dec 11 21:33:04 PST 2006
> Index: llvm/lib/Transforms/Utils/LowerAllocations.cpp
> diff -u llvm/lib/Transforms/Utils/LowerAllocations.cpp:1.64 llvm/
> lib/Transforms/Utils/LowerAllocations.cpp:1.65
> --- llvm/lib/Transforms/Utils/LowerAllocations.cpp:1.64 Wed Dec 6
> 11:46:33 2006
> +++ llvm/lib/Transforms/Utils/LowerAllocations.cpp Mon Dec 11
> 23:05:00 2006
> @@ -122,14 +122,15 @@
> MallocArg = ConstantInt::get(Type::ULongTy, TD.getTypeSize
> (AllocTy));
> else
> MallocArg = ConstantExpr::getSizeOf(AllocTy);
> - MallocArg = ConstantExpr::getCast(cast<Constant>(MallocArg),
> IntPtrTy);
> + MallocArg = ConstantExpr::getIntegerCast(cast<Constant>
> (MallocArg),
> + IntPtrTy, true /
> *SExt*/);
This is always trunc or bitcast.
> if (MI->isArrayAllocation()) {
> if (isa<ConstantInt>(MallocArg) &&
> cast<ConstantInt>(MallocArg)->getZExtValue() == 1) {
> MallocArg = MI->getOperand(0); // Operand * 1 =
> Operand
> } else if (Constant *CO = dyn_cast<Constant>(MI->getOperand
> (0))) {
> - CO = ConstantExpr::getCast(CO, IntPtrTy);
> + CO = ConstantExpr::getIntegerCast(CO, IntPtrTy, true /
> *SExt*/);
This should zext, not sext.
> MallocArg = ConstantExpr::getMul(CO, cast<Constant>
> (MallocArg));
> } else {
> Value *Scale = MI->getOperand(0);
>
-Chris
More information about the llvm-commits
mailing list