diff options
author | Matt Arsenault <Matthew.Arsenault@amd.com> | 2013-09-10 19:55:24 +0000 |
---|---|---|
committer | Matt Arsenault <Matthew.Arsenault@amd.com> | 2013-09-10 19:55:24 +0000 |
commit | a90a18e0eac1cf76201ae3e9f847d9f285f14e10 (patch) | |
tree | 478c072d0489a99b0e43a245ca275e9f0a61fbe9 /llvm/lib/Analysis/ScalarEvolutionExpander.cpp | |
parent | 305a22555a1ec2cf3758283e0e4754114f5df78e (diff) | |
download | llvm-a90a18e0eac1cf76201ae3e9f847d9f285f14e10.zip llvm-a90a18e0eac1cf76201ae3e9f847d9f285f14e10.tar.gz llvm-a90a18e0eac1cf76201ae3e9f847d9f285f14e10.tar.bz2 |
Teach ScalarEvolution about pointer address spaces
llvm-svn: 190425
Diffstat (limited to 'llvm/lib/Analysis/ScalarEvolutionExpander.cpp')
-rw-r--r-- | llvm/lib/Analysis/ScalarEvolutionExpander.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/llvm/lib/Analysis/ScalarEvolutionExpander.cpp b/llvm/lib/Analysis/ScalarEvolutionExpander.cpp index 14ba330..ab631f9 100644 --- a/llvm/lib/Analysis/ScalarEvolutionExpander.cpp +++ b/llvm/lib/Analysis/ScalarEvolutionExpander.cpp @@ -407,6 +407,10 @@ Value *SCEVExpander::expandAddToGEP(const SCEV *const *op_begin, // without the other. SplitAddRecs(Ops, Ty, SE); + Type *IntPtrTy = SE.TD + ? SE.TD->getIntPtrType(PTy) + : Type::getInt64Ty(PTy->getContext()); + // Descend down the pointer's type and attempt to convert the other // operands into GEP indices, at each level. The first index in a GEP // indexes into the array implied by the pointer operand; the rest of @@ -417,7 +421,7 @@ Value *SCEVExpander::expandAddToGEP(const SCEV *const *op_begin, // array indexing. SmallVector<const SCEV *, 8> ScaledOps; if (ElTy->isSized()) { - const SCEV *ElSize = SE.getSizeOfExpr(ElTy); + const SCEV *ElSize = SE.getSizeOfExpr(IntPtrTy, ElTy); if (!ElSize->isZero()) { SmallVector<const SCEV *, 8> NewOps; for (unsigned i = 0, e = Ops.size(); i != e; ++i) { |