summaryrefslogtreecommitdiffstats
path: root/lib/Analysis/BasicAliasAnalysis.cpp
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2010-09-15 20:08:03 +0000
committerEli Friedman <eli.friedman@gmail.com>2010-09-15 20:08:03 +0000
commit39e30124e50534972c2e58f4dab7d67c0c437743 (patch)
tree59b24fd99818b00bf4ee5e5627341252763b7b6b /lib/Analysis/BasicAliasAnalysis.cpp
parentf1c3eb37ae96572e1df34bf980b9ecd149b5ee33 (diff)
downloadexternal_llvm-39e30124e50534972c2e58f4dab7d67c0c437743.zip
external_llvm-39e30124e50534972c2e58f4dab7d67c0c437743.tar.gz
external_llvm-39e30124e50534972c2e58f4dab7d67c0c437743.tar.bz2
PR7959: Handle negative scales in GEPs correctly in BasicAA for non-64-bit
targets. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114015 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/BasicAliasAnalysis.cpp')
-rw-r--r--lib/Analysis/BasicAliasAnalysis.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/Analysis/BasicAliasAnalysis.cpp b/lib/Analysis/BasicAliasAnalysis.cpp
index 69a1c0c..32a1726 100644
--- a/lib/Analysis/BasicAliasAnalysis.cpp
+++ b/lib/Analysis/BasicAliasAnalysis.cpp
@@ -386,8 +386,8 @@ DecomposeGEPExpression(const Value *V, int64_t &BaseOffs,
// The GEP index scale ("Scale") scales C1*V+C2, yielding (C1*V+C2)*Scale.
// This gives us an aggregate computation of (C1*Scale)*V + C2*Scale.
- BaseOffs += IndexOffset.getZExtValue()*Scale;
- Scale *= IndexScale.getZExtValue();
+ BaseOffs += IndexOffset.getSExtValue()*Scale;
+ Scale *= IndexScale.getSExtValue();
// If we already had an occurrance of this index variable, merge this
@@ -407,7 +407,7 @@ DecomposeGEPExpression(const Value *V, int64_t &BaseOffs,
// pointer size.
if (unsigned ShiftBits = 64-TD->getPointerSizeInBits()) {
Scale <<= ShiftBits;
- Scale >>= ShiftBits;
+ Scale = (int64_t)Scale >> ShiftBits;
}
if (Scale) {