summaryrefslogtreecommitdiff
path: root/lib/Transforms/Utils/LowerAllocations.cpp
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2006-12-12 05:05:00 +0000
committerReid Spencer <rspencer@reidspencer.com>2006-12-12 05:05:00 +0000
commit4da49122f3f3c8da68a52723d846b88c72166a68 (patch)
treea7cb69a70439f795df63c88c5d56200e3ae17be6 /lib/Transforms/Utils/LowerAllocations.cpp
parenta30fc5ed0430081f6495b33e027b7655ca2a66e5 (diff)
downloadllvm-4da49122f3f3c8da68a52723d846b88c72166a68.tar.gz
llvm-4da49122f3f3c8da68a52723d846b88c72166a68.tar.bz2
llvm-4da49122f3f3c8da68a52723d846b88c72166a68.tar.xz
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
Diffstat (limited to 'lib/Transforms/Utils/LowerAllocations.cpp')
-rw-r--r--lib/Transforms/Utils/LowerAllocations.cpp5
1 files changed, 3 insertions, 2 deletions
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<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);