[llvm] 1cfbbba - [AA] Remove unnecessary intersections from getModRefBehavior() (NFC)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 14 05:26:51 PDT 2022
Author: Nikita Popov
Date: 2022-09-14T14:26:39+02:00
New Revision: 1cfbbba15bd433d5562e6ba5ed19d8c2a1806618
URL: https://github.com/llvm/llvm-project/commit/1cfbbba15bd433d5562e6ba5ed19d8c2a1806618
DIFF: https://github.com/llvm/llvm-project/commit/1cfbbba15bd433d5562e6ba5ed19d8c2a1806618.diff
LOG: [AA] Remove unnecessary intersections from getModRefBehavior() (NFC)
Intersection with other providers is performed by AAResults. Doing
this here is both pointless and confusing.
Added:
Modified:
llvm/lib/Analysis/GlobalsModRef.cpp
llvm/lib/Analysis/TypeBasedAliasAnalysis.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Analysis/GlobalsModRef.cpp b/llvm/lib/Analysis/GlobalsModRef.cpp
index f87f1989c4368..54da2ed81667e 100644
--- a/llvm/lib/Analysis/GlobalsModRef.cpp
+++ b/llvm/lib/Analysis/GlobalsModRef.cpp
@@ -239,16 +239,14 @@ void GlobalsAAResult::DeletionCallbackHandle::deleted() {
}
FunctionModRefBehavior GlobalsAAResult::getModRefBehavior(const Function *F) {
- FunctionModRefBehavior Min = FMRB_UnknownModRefBehavior;
-
if (FunctionInfo *FI = getFunctionInfo(F)) {
if (!isModOrRefSet(FI->getModRefInfo()))
- Min = FMRB_DoesNotAccessMemory;
+ return FMRB_DoesNotAccessMemory;
else if (!isModSet(FI->getModRefInfo()))
- Min = FMRB_OnlyReadsMemory;
+ return FMRB_OnlyReadsMemory;
}
- return FunctionModRefBehavior(AAResultBase::getModRefBehavior(F) & Min);
+ return AAResultBase::getModRefBehavior(F);
}
/// Returns the function info for the function, or null if we don't have
diff --git a/llvm/lib/Analysis/TypeBasedAliasAnalysis.cpp b/llvm/lib/Analysis/TypeBasedAliasAnalysis.cpp
index 216027778fab9..c6fda7e8e5aab 100644
--- a/llvm/lib/Analysis/TypeBasedAliasAnalysis.cpp
+++ b/llvm/lib/Analysis/TypeBasedAliasAnalysis.cpp
@@ -409,16 +409,14 @@ TypeBasedAAResult::getModRefBehavior(const CallBase *Call) {
if (!EnableTBAA)
return AAResultBase::getModRefBehavior(Call);
- FunctionModRefBehavior Min = FMRB_UnknownModRefBehavior;
-
// If this is an "immutable" type, we can assume the call doesn't write
// to memory.
if (const MDNode *M = Call->getMetadata(LLVMContext::MD_tbaa))
if ((!isStructPathTBAA(M) && TBAANode(M).isTypeImmutable()) ||
(isStructPathTBAA(M) && TBAAStructTagNode(M).isTypeImmutable()))
- Min = FMRB_OnlyReadsMemory;
+ return FMRB_OnlyReadsMemory;
- return FunctionModRefBehavior(AAResultBase::getModRefBehavior(Call) & Min);
+ return AAResultBase::getModRefBehavior(Call);
}
FunctionModRefBehavior TypeBasedAAResult::getModRefBehavior(const Function *F) {
More information about the llvm-commits
mailing list