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/GlobalsModRef.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/GlobalsModRef.cpp')
-rw-r--r-- | llvm/lib/Analysis/GlobalsModRef.cpp | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/llvm/lib/Analysis/GlobalsModRef.cpp b/llvm/lib/Analysis/GlobalsModRef.cpp index e6ef1c7..b1b6790 100644 --- a/llvm/lib/Analysis/GlobalsModRef.cpp +++ b/llvm/lib/Analysis/GlobalsModRef.cpp @@ -87,17 +87,14 @@ class GlobalsAAResult::FunctionInfo { /// The bit that flags that this function may read any global. This is /// chosen to mix together with ModRefInfo bits. /// FIXME: This assumes ModRefInfo lattice will remain 4 bits! - /// It overlaps with ModRefInfo::Must bit! /// FunctionInfo.getModRefInfo() masks out everything except ModRef so - /// this remains correct, but the Must info is lost. + /// this remains correct. enum { MayReadAnyGlobal = 4 }; /// Checks to document the invariants of the bit packing here. - static_assert((MayReadAnyGlobal & static_cast<int>(ModRefInfo::MustModRef)) == - 0, + static_assert((MayReadAnyGlobal & static_cast<int>(ModRefInfo::ModRef)) == 0, "ModRef and the MayReadAnyGlobal flag bits overlap."); - static_assert(((MayReadAnyGlobal | - static_cast<int>(ModRefInfo::MustModRef)) >> + static_assert(((MayReadAnyGlobal | static_cast<int>(ModRefInfo::ModRef)) >> AlignedMapPointerTraits::NumLowBitsAvailable) == 0, "Insufficient low bits to store our flag and ModRef info."); @@ -133,11 +130,9 @@ public: } /// This method clears MayReadAnyGlobal bit added by GlobalsAAResult to return - /// the corresponding ModRefInfo. It must align in functionality with - /// clearMust(). + /// the corresponding ModRefInfo. ModRefInfo globalClearMayReadAnyGlobal(int I) const { - return ModRefInfo((I & static_cast<int>(ModRefInfo::ModRef)) | - static_cast<int>(ModRefInfo::NoModRef)); + return ModRefInfo(I & static_cast<int>(ModRefInfo::ModRef)); } /// Returns the \c ModRefInfo info for this function. @@ -147,7 +142,7 @@ public: /// Adds new \c ModRefInfo for this function to its state. void addModRefInfo(ModRefInfo NewMRI) { - Info.setInt(Info.getInt() | static_cast<int>(setMust(NewMRI))); + Info.setInt(Info.getInt() | static_cast<int>(NewMRI)); } /// Returns whether this function may read any global variable, and we don't |