Changes in directory llvm/lib/Transforms/Utils:
LowerAllocations.cpp updated: 1.64 -> 1.65 LowerInvoke.cpp updated: 1.45 -> 1.46 --- Log message: Change inferred getCast into specific getCast. Passes all tests. --- Diffs of the changes: (+9 -4) LowerAllocations.cpp | 5 +++-- LowerInvoke.cpp | 8 ++++++-- 2 files changed, 9 insertions(+), 4 deletions(-) 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*/); 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*/); MallocArg = ConstantExpr::getMul(CO, cast<Constant>(MallocArg)); } else { Value *Scale = MI->getOperand(0); Index: llvm/lib/Transforms/Utils/LowerInvoke.cpp diff -u llvm/lib/Transforms/Utils/LowerInvoke.cpp:1.45 llvm/lib/Transforms/Utils/LowerInvoke.cpp:1.46 --- llvm/lib/Transforms/Utils/LowerInvoke.cpp:1.45 Wed Dec 6 11:46:33 2006 +++ llvm/lib/Transforms/Utils/LowerInvoke.cpp Mon Dec 11 23:05:00 2006 @@ -215,8 +215,12 @@ unsigned NumArgs = FT->getNumParams(); for (unsigned i = 0; i != 3; ++i) if (i < NumArgs && FT->getParamType(i) != Args[i]->getType()) - Args[i] = ConstantExpr::getCast(cast<Constant>(Args[i]), - FT->getParamType(i)); + if (Args[i]->getType()->isInteger()) + Args[i] = ConstantExpr::getIntegerCast(cast<Constant>(Args[i]), + FT->getParamType(i), true); + else + Args[i] = ConstantExpr::getBitCast(cast<Constant>(Args[i]), + FT->getParamType(i)); (new CallInst(WriteFn, Args, "", IB))->setTailCall(); } _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits