diff options
| author | Reid Spencer <rspencer@reidspencer.com> | 2006-12-12 09:17:08 +0000 |
|---|---|---|
| committer | Reid Spencer <rspencer@reidspencer.com> | 2006-12-12 09:17:08 +0000 |
| commit | 41cb269a2b1e3e05c34f331964a51881bbaf232c (patch) | |
| tree | 398b9ee01049a4b713011bb34c4544c92e8e3e76 /llvm/lib/Transforms | |
| parent | 0c0b78c18e0f224e8757859d61b11d35a014b0c9 (diff) | |
| download | bcm5719-llvm-41cb269a2b1e3e05c34f331964a51881bbaf232c.tar.gz bcm5719-llvm-41cb269a2b1e3e05c34f331964a51881bbaf232c.zip | |
Fix the casting for the computation of the Malloc size.
llvm-svn: 32477
Diffstat (limited to 'llvm/lib/Transforms')
| -rw-r--r-- | llvm/lib/Transforms/Utils/LowerAllocations.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/Utils/LowerAllocations.cpp b/llvm/lib/Transforms/Utils/LowerAllocations.cpp index 40a4dc0d305..d011d754757 100644 --- a/llvm/lib/Transforms/Utils/LowerAllocations.cpp +++ b/llvm/lib/Transforms/Utils/LowerAllocations.cpp @@ -122,15 +122,15 @@ bool LowerAllocations::runOnBasicBlock(BasicBlock &BB) { MallocArg = ConstantInt::get(Type::ULongTy, TD.getTypeSize(AllocTy)); else MallocArg = ConstantExpr::getSizeOf(AllocTy); - MallocArg = ConstantExpr::getIntegerCast(cast<Constant>(MallocArg), - IntPtrTy, true /*SExt*/); + MallocArg = ConstantExpr::getTruncOrBitCast(cast<Constant>(MallocArg), + IntPtrTy); 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::getIntegerCast(CO, IntPtrTy, true /*SExt*/); + CO = ConstantExpr::getIntegerCast(CO, IntPtrTy, false /*ZExt*/); MallocArg = ConstantExpr::getMul(CO, cast<Constant>(MallocArg)); } else { Value *Scale = MI->getOperand(0); |

