summaryrefslogtreecommitdiff
path: root/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
commit4da49122f3f3c8da68a52723d846b88c72166a68 (patch)
treea7cb69a70439f795df63c88c5d56200e3ae17be6 /lib/Transforms/Scalar/LoopStrengthReduce.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/Scalar/LoopStrengthReduce.cpp')
-rw-r--r--lib/Transforms/Scalar/LoopStrengthReduce.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/lib/Transforms/Scalar/LoopStrengthReduce.cpp
index 66b595fd7f..c132aaef92 100644
--- a/lib/Transforms/Scalar/LoopStrengthReduce.cpp
+++ b/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;