summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Utils
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
commitb341b0861dcfdfd4453b32169a86302a275b81c9 (patch)
treec407db06dc5ffde18fc136ce1a87da9ede9f33c2 /llvm/lib/Transforms/Utils
parent6e5fe376ec898e651526107485d2a0f6e4000789 (diff)
downloadbcm5719-llvm-b341b0861dcfdfd4453b32169a86302a275b81c9.tar.gz
bcm5719-llvm-b341b0861dcfdfd4453b32169a86302a275b81c9.zip
Change inferred getCast into specific getCast. Passes all tests.
llvm-svn: 32469
Diffstat (limited to 'llvm/lib/Transforms/Utils')
-rw-r--r--llvm/lib/Transforms/Utils/LowerAllocations.cpp5
-rw-r--r--llvm/lib/Transforms/Utils/LowerInvoke.cpp8
2 files changed, 9 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/Utils/LowerAllocations.cpp b/llvm/lib/Transforms/Utils/LowerAllocations.cpp
index 75a4c704c91..40a4dc0d305 100644
--- a/llvm/lib/Transforms/Utils/LowerAllocations.cpp
+++ b/llvm/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);
diff --git a/llvm/lib/Transforms/Utils/LowerInvoke.cpp b/llvm/lib/Transforms/Utils/LowerInvoke.cpp
index dfeb8349f4a..4fbd43c6f4d 100644
--- a/llvm/lib/Transforms/Utils/LowerInvoke.cpp
+++ b/llvm/lib/Transforms/Utils/LowerInvoke.cpp
@@ -215,8 +215,12 @@ void LowerInvoke::writeAbortMessage(Instruction *IB) {
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();
}
OpenPOWER on IntegriCloud