forked from OSchip/llvm-project
[BasicAA] Avoid duplicate cache lookup (NFCI)
Rather than performing the cache lookup with both possible orders for the locations, use the same canonicalization as the other AliasCache lookups in BasicAA.
This commit is contained in:
parent
d09c592142
commit
1a7a9efec3
|
@ -804,11 +804,10 @@ AliasResult BasicAAResult::alias(const MemoryLocation &LocA,
|
|||
// If we have a directly cached entry for these locations, we have recursed
|
||||
// through this once, so just return the cached results. Notably, when this
|
||||
// happens, we don't clear the cache.
|
||||
auto CacheIt = AAQI.AliasCache.find(AAQueryInfo::LocPair(LocA, LocB));
|
||||
if (CacheIt != AAQI.AliasCache.end())
|
||||
return CacheIt->second;
|
||||
|
||||
CacheIt = AAQI.AliasCache.find(AAQueryInfo::LocPair(LocB, LocA));
|
||||
AAQueryInfo::LocPair Locs(LocA, LocB);
|
||||
if (Locs.first.Ptr > Locs.second.Ptr)
|
||||
std::swap(Locs.first, Locs.second);
|
||||
auto CacheIt = AAQI.AliasCache.find(Locs);
|
||||
if (CacheIt != AAQI.AliasCache.end())
|
||||
return CacheIt->second;
|
||||
|
||||
|
|
Loading…
Reference in New Issue