mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-12 13:30:51 +00:00
Merge in fix for PR9561.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_29@128354 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
59460aba2e
commit
db2629e109
@ -340,24 +340,33 @@ static bool isCompleteOverwrite(const AliasAnalysis::Location &Later,
|
|||||||
// Okay, we have stores to two completely different pointers. Try to
|
// Okay, we have stores to two completely different pointers. Try to
|
||||||
// decompose the pointer into a "base + constant_offset" form. If the base
|
// decompose the pointer into a "base + constant_offset" form. If the base
|
||||||
// pointers are equal, then we can reason about the two stores.
|
// pointers are equal, then we can reason about the two stores.
|
||||||
int64_t Off1 = 0, Off2 = 0;
|
int64_t EarlierOff = 0, LaterOff = 0;
|
||||||
const Value *BP1 = GetPointerBaseWithConstantOffset(P1, Off1, TD);
|
const Value *BP1 = GetPointerBaseWithConstantOffset(P1, EarlierOff, TD);
|
||||||
const Value *BP2 = GetPointerBaseWithConstantOffset(P2, Off2, TD);
|
const Value *BP2 = GetPointerBaseWithConstantOffset(P2, LaterOff, TD);
|
||||||
|
|
||||||
// If the base pointers still differ, we have two completely different stores.
|
// If the base pointers still differ, we have two completely different stores.
|
||||||
if (BP1 != BP2)
|
if (BP1 != BP2)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Otherwise, we might have a situation like:
|
// The later store completely overlaps the earlier store if:
|
||||||
// store i16 -> P + 1 Byte
|
//
|
||||||
// store i32 -> P
|
// 1. Both start at the same offset and the later one's size is greater than
|
||||||
// In this case, we see if the later store completely overlaps all bytes
|
// or equal to the earlier one's, or
|
||||||
// stored by the previous store.
|
//
|
||||||
if (Off1 < Off2 || // Earlier starts before Later.
|
// |--earlier--|
|
||||||
Off1+Earlier.Size > Off2+Later.Size) // Earlier goes beyond Later.
|
// |-- later --|
|
||||||
return false;
|
//
|
||||||
// Otherwise, we have complete overlap.
|
// 2. The earlier store has an offset greater than the later offset, but which
|
||||||
return true;
|
// still lies completely within the later store.
|
||||||
|
//
|
||||||
|
// |--earlier--|
|
||||||
|
// |----- later ------|
|
||||||
|
if (EarlierOff >= LaterOff &&
|
||||||
|
EarlierOff + Earlier.Size <= LaterOff + Later.Size)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
// Otherwise, they don't completely overlap.
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// isPossibleSelfRead - If 'Inst' might be a self read (i.e. a noop copy of a
|
/// isPossibleSelfRead - If 'Inst' might be a self read (i.e. a noop copy of a
|
||||||
|
Loading…
Reference in New Issue
Block a user