summaryrefslogtreecommitdiffstats
path: root/llvm/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
commitab3a128582aea9d6e73cbdca82f6ae2590af8fd2 (patch)
treec6a45e4d59f22bd9a716d32d940db24131ed95b0 /llvm/lib/Analysis/BasicAliasAnalysis.cpp
parent50e2658f6315ac001d7747d2c6e7ce4aef322ba1 (diff)
downloadbcm5719-llvm-ab3a128582aea9d6e73cbdca82f6ae2590af8fd2.tar.gz
bcm5719-llvm-ab3a128582aea9d6e73cbdca82f6ae2590af8fd2.zip
PR7959: Handle negative scales in GEPs correctly in BasicAA for non-64-bit
targets. llvm-svn: 114015
Diffstat (limited to 'llvm/lib/Analysis/BasicAliasAnalysis.cpp')
-rw-r--r--llvm/lib/Analysis/BasicAliasAnalysis.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/lib/Analysis/BasicAliasAnalysis.cpp b/llvm/lib/Analysis/BasicAliasAnalysis.cpp
index 69a1c0c772d..32a17264d50 100644
--- a/llvm/lib/Analysis/BasicAliasAnalysis.cpp
+++ b/llvm/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) {
OpenPOWER on IntegriCloud