diff options
author | Nikita Popov <npopov@redhat.com> | 2022-07-28 17:23:36 +0200 |
---|---|---|
committer | Nikita Popov <npopov@redhat.com> | 2022-08-01 07:14:31 +0200 |
commit | f96ea53e892e0dfc1ee778868c1ed33616b95a82 (patch) | |
tree | 57c2ae7a735c48da3f6ac3783d917eea5d0c266a /llvm/lib/Analysis/BasicAliasAnalysis.cpp | |
parent | 967f95fb074deadfb1109cec5f42d83db7eff00b (diff) | |
download | llvm-f96ea53e892e0dfc1ee778868c1ed33616b95a82.zip llvm-f96ea53e892e0dfc1ee778868c1ed33616b95a82.tar.gz llvm-f96ea53e892e0dfc1ee778868c1ed33616b95a82.tar.bz2 |
[AA] Do not track Must in ModRefInfo
getModRefInfo() queries currently track whether the result is a
MustAlias on a best-effort basis. The only user of this functionality
is the optimized memory access type in MemorySSA -- which in turn
has no users. Given that this functionality has not found a user
since it was introduced five years ago (in D38862), I think we
should drop it again.
The context is that I'm working to separate FunctionModRefBehavior
to track mod/ref for different location kinds (like argmem or
inaccessiblemem) separately, and the fact that ModRefInfo also has
an unrelated Must flag makes this quite awkward, especially as this
means that NoModRef is not a zero value. If we want to retain the
functionality, I would probably split getModRefInfo() results into
a part that just contains the ModRef information, and a separate
part containing a (best-effort) AliasResult.
Differential Revision: https://reviews.llvm.org/D130713
Diffstat (limited to 'llvm/lib/Analysis/BasicAliasAnalysis.cpp')
-rw-r--r-- | llvm/lib/Analysis/BasicAliasAnalysis.cpp | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/llvm/lib/Analysis/BasicAliasAnalysis.cpp b/llvm/lib/Analysis/BasicAliasAnalysis.cpp index c3b032ab..b534164 100644 --- a/llvm/lib/Analysis/BasicAliasAnalysis.cpp +++ b/llvm/lib/Analysis/BasicAliasAnalysis.cpp @@ -912,7 +912,6 @@ ModRefInfo BasicAAResult::getModRefInfo(const CallBase *Call, // Optimistically assume that call doesn't touch Object and check this // assumption in the following loop. ModRefInfo Result = ModRefInfo::NoModRef; - bool IsMustAlias = true; unsigned OperandNo = 0; for (auto CI = Call->data_operands_begin(), CE = Call->data_operands_end(); @@ -935,8 +934,6 @@ ModRefInfo BasicAAResult::getModRefInfo(const CallBase *Call, AliasResult AR = getBestAAResults().alias( MemoryLocation::getBeforeOrAfter(*CI), MemoryLocation::getBeforeOrAfter(Object), AAQI); - if (AR != AliasResult::MustAlias) - IsMustAlias = false; // Operand doesn't alias 'Object', continue looking for other aliases if (AR == AliasResult::NoAlias) continue; @@ -958,17 +955,9 @@ ModRefInfo BasicAAResult::getModRefInfo(const CallBase *Call, break; } - // No operand aliases, reset Must bit. Add below if at least one aliases - // and all aliases found are MustAlias. - if (isNoModRef(Result)) - IsMustAlias = false; - // Early return if we improved mod ref information - if (!isModAndRefSet(Result)) { - if (isNoModRef(Result)) - return ModRefInfo::NoModRef; - return IsMustAlias ? setMust(Result) : clearMust(Result); - } + if (!isModAndRefSet(Result)) + return Result; } // If the call is malloc/calloc like, we can assume that it doesn't |