mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-24 23:28:41 +00:00
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
This commit is contained in:
@@ -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) {
|
||||
|
Reference in New Issue
Block a user