mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-26 12:20:42 +00:00
Make getModRefInfo with a default location not crash.
Add getModRefInfo that works without location. Add unit tests. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234811 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -330,7 +330,7 @@ AliasAnalysis::getModRefInfo(const LoadInst *L, const Location &Loc) {
|
||||
|
||||
// If the load address doesn't alias the given address, it doesn't read
|
||||
// or write the specified memory.
|
||||
if (!alias(getLocation(L), Loc))
|
||||
if (Loc.Ptr && !alias(getLocation(L), Loc))
|
||||
return NoModRef;
|
||||
|
||||
// Otherwise, a load just reads.
|
||||
@@ -343,15 +343,18 @@ AliasAnalysis::getModRefInfo(const StoreInst *S, const Location &Loc) {
|
||||
if (!S->isUnordered())
|
||||
return ModRef;
|
||||
|
||||
// If the store address cannot alias the pointer in question, then the
|
||||
// specified memory cannot be modified by the store.
|
||||
if (!alias(getLocation(S), Loc))
|
||||
return NoModRef;
|
||||
if (Loc.Ptr) {
|
||||
// If the store address cannot alias the pointer in question, then the
|
||||
// specified memory cannot be modified by the store.
|
||||
if (!alias(getLocation(S), Loc))
|
||||
return NoModRef;
|
||||
|
||||
// If the pointer is a pointer to constant memory, then it could not have been
|
||||
// modified by this store.
|
||||
if (pointsToConstantMemory(Loc))
|
||||
return NoModRef;
|
||||
// If the pointer is a pointer to constant memory, then it could not have
|
||||
// been modified by this store.
|
||||
if (pointsToConstantMemory(Loc))
|
||||
return NoModRef;
|
||||
|
||||
}
|
||||
|
||||
// Otherwise, a store just writes.
|
||||
return Mod;
|
||||
|
||||
Reference in New Issue
Block a user