From 4da49122f3f3c8da68a52723d846b88c72166a68 Mon Sep 17 00:00:00 2001 From: Reid Spencer Date: Tue, 12 Dec 2006 05:05:00 +0000 Subject: Change inferred getCast into specific getCast. Passes all tests. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32469 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/Utils/LowerAllocations.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'lib/Transforms/Utils/LowerAllocations.cpp') diff --git a/lib/Transforms/Utils/LowerAllocations.cpp b/lib/Transforms/Utils/LowerAllocations.cpp index 75a4c704c9..40a4dc0d30 100644 --- a/lib/Transforms/Utils/LowerAllocations.cpp +++ b/lib/Transforms/Utils/LowerAllocations.cpp @@ -122,14 +122,15 @@ bool LowerAllocations::runOnBasicBlock(BasicBlock &BB) { MallocArg = ConstantInt::get(Type::ULongTy, TD.getTypeSize(AllocTy)); else MallocArg = ConstantExpr::getSizeOf(AllocTy); - MallocArg = ConstantExpr::getCast(cast(MallocArg), IntPtrTy); + MallocArg = ConstantExpr::getIntegerCast(cast(MallocArg), + IntPtrTy, true /*SExt*/); if (MI->isArrayAllocation()) { if (isa(MallocArg) && cast(MallocArg)->getZExtValue() == 1) { MallocArg = MI->getOperand(0); // Operand * 1 = Operand } else if (Constant *CO = dyn_cast(MI->getOperand(0))) { - CO = ConstantExpr::getCast(CO, IntPtrTy); + CO = ConstantExpr::getIntegerCast(CO, IntPtrTy, true /*SExt*/); MallocArg = ConstantExpr::getMul(CO, cast(MallocArg)); } else { Value *Scale = MI->getOperand(0); -- cgit v1.2.3