[llvm-branch-commits] [llvm] 6f5ef64 - [BasicAA] Avoid unnecessary cache update (NFC)
Nikita Popov via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Sun Nov 22 11:15:16 PST 2020
Author: Nikita Popov
Date: 2020-11-22T20:10:45+01:00
New Revision: 6f5ef648a57aed3274118dcbd6467e8ac4f6ed1f
URL: https://github.com/llvm/llvm-project/commit/6f5ef648a57aed3274118dcbd6467e8ac4f6ed1f
DIFF: https://github.com/llvm/llvm-project/commit/6f5ef648a57aed3274118dcbd6467e8ac4f6ed1f.diff
LOG: [BasicAA] Avoid unnecessary cache update (NFC)
If the final recursive query returns MayAlias as well, there is
no need to update the cache (which already stores MayAlias).
Added:
Modified:
llvm/lib/Analysis/BasicAliasAnalysis.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Analysis/BasicAliasAnalysis.cpp b/llvm/lib/Analysis/BasicAliasAnalysis.cpp
index cfc1c59c15d9..16043da339c3 100644
--- a/llvm/lib/Analysis/BasicAliasAnalysis.cpp
+++ b/llvm/lib/Analysis/BasicAliasAnalysis.cpp
@@ -1785,7 +1785,11 @@ AliasResult BasicAAResult::aliasCheck(const Value *V1, LocationSize V1Size,
// 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.
More information about the llvm-branch-commits
mailing list