aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Utils/InlineFunction.cpp
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2021-04-17 14:51:29 +0200
committerNikita Popov <nikita.ppv@gmail.com>2021-04-17 14:56:13 +0200
commite68b12c99eaf9cdfdf3e3e7c4533bb03b60afd36 (patch)
treeb8efb220c1dcc0efc04835fd315a426bbbe9052c /llvm/lib/Transforms/Utils/InlineFunction.cpp
parent595394321d51c49e317a8a8da944e203f9b8633c (diff)
downloadllvm-e68b12c99eaf9cdfdf3e3e7c4533bb03b60afd36.zip
llvm-e68b12c99eaf9cdfdf3e3e7c4533bb03b60afd36.tar.gz
llvm-e68b12c99eaf9cdfdf3e3e7c4533bb03b60afd36.tar.bz2
[Inline] Don't add noalias metadata to inaccessiblememonly calls
It will not do anything useful for them, as we already know that they don't modref with any accessible memory. In particular, this prevents noalias metadata from being placed on noalias.scope.decl intrinsics. This reduces the amount of metadata needed, and makes it more likely that unnecessary decls can be eliminated.
Diffstat (limited to 'llvm/lib/Transforms/Utils/InlineFunction.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/InlineFunction.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Utils/InlineFunction.cpp b/llvm/lib/Transforms/Utils/InlineFunction.cpp
index 60fc5b2..201e4e1 100644
--- a/llvm/lib/Transforms/Utils/InlineFunction.cpp
+++ b/llvm/lib/Transforms/Utils/InlineFunction.cpp
@@ -1041,6 +1041,11 @@ static void AddAliasScopeMetadata(CallBase &CB, ValueToValueMapTy &VMap,
IsFuncCall = true;
if (CalleeAAR) {
FunctionModRefBehavior MRB = CalleeAAR->getModRefBehavior(Call);
+
+ // We'll retain this knowledge without additional metadata.
+ if (AAResults::onlyAccessesInaccessibleMem(MRB))
+ continue;
+
if (AAResults::onlyAccessesArgPointees(MRB))
IsArgMemOnlyCall = true;
}