summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2009-04-16 21:34:54 +0000
committerDan Gohman <gohman@apple.com>2009-04-16 21:34:54 +0000
commit72dc8452a3dd143637fad0759931794b4edbd45d (patch)
tree9846379f2fcab3ff0f436360a0372acb67f8ea62 /llvm/lib/Analysis/ScalarEvolutionExpander.cpp
parenteefba6bbe098770d9fea147559c9e05e27a993e3 (diff)
downloadbcm5719-llvm-72dc8452a3dd143637fad0759931794b4edbd45d.tar.gz
bcm5719-llvm-72dc8452a3dd143637fad0759931794b4edbd45d.zip
Handle a pointer type correctly in SCEVExpander::visitAddRecExpr.
llvm-svn: 69310
Diffstat (limited to 'llvm/lib/Analysis/ScalarEvolutionExpander.cpp')
-rw-r--r--llvm/lib/Analysis/ScalarEvolutionExpander.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/ScalarEvolutionExpander.cpp b/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
index 0e0eb55a058..c27bbdc9b1c 100644
--- a/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
+++ b/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
@@ -227,6 +227,8 @@ Value *SCEVExpander::visitAddRecExpr(SCEVAddRecExpr *S) {
// If this is a simple linear addrec, emit it now as a special case.
if (S->isAffine()) { // {0,+,F} --> i*F
Value *F = expand(S->getOperand(1));
+ if (isa<PointerType>(F->getType()))
+ F = InsertCastOfTo(Instruction::PtrToInt, F, TD.getIntPtrType());
// IF the step is by one, just return the inserted IV.
if (ConstantInt *CI = dyn_cast<ConstantInt>(F))
OpenPOWER on IntegriCloud