If the final recursive query returns MayAlias as well, there is
no need to update the cache (which already stores MayAlias).
// memory locations. We have already ensured that BasicAA has a MayAlias
// cache result for these, so any recursion back into BasicAA won't loop.
AliasResult Result = getBestAAResults().alias(Locs.first, Locs.second, AAQI);
- return AAQI.updateResult(Locs, Result);
+ if (Result != MayAlias)
+ return AAQI.updateResult(Locs, Result);
+
+ // MayAlias is already in the cache.
+ return MayAlias;
}
/// Check whether two Values can be considered equivalent.