summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar/LoopStrengthReduce.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
commitb341b0861dcfdfd4453b32169a86302a275b81c9 (patch)
treec407db06dc5ffde18fc136ce1a87da9ede9f33c2 /llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
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/Scalar/LoopStrengthReduce.cpp')
-rw-r--r--llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
index 66b595fd7f7..c132aaef927 100644
--- a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
@@ -200,12 +200,17 @@ FunctionPass *llvm::createLoopStrengthReducePass(const TargetLowering *TLI) {
return new LoopStrengthReduce(TLI);
}
-/// getCastedVersionOf - Return the specified value casted to uintptr_t.
+/// getCastedVersionOf - Return the specified value casted to uintptr_t. This
+/// assumes that the Value* V is of integer or pointer type only.
///
Value *LoopStrengthReduce::getCastedVersionOf(Value *V) {
if (V->getType() == UIntPtrTy) return V;
if (Constant *CB = dyn_cast<Constant>(V))
- return ConstantExpr::getCast(CB, UIntPtrTy);
+ if (CB->getType()->isInteger())
+ return ConstantExpr::getIntegerCast(CB, UIntPtrTy,
+ CB->getType()->isSigned());
+ else
+ return ConstantExpr::getPtrToInt(CB, UIntPtrTy);
Value *&New = CastedPointers[V];
if (New) return New;
OpenPOWER on IntegriCloud