[PATCH] D93602: [AA] byval argument is identified function local

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 21 11:18:43 PST 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rG82bd64fff632: [AA] byval argument is identified function local (authored by nikic).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D93602/new/

https://reviews.llvm.org/D93602

Files:
  llvm/include/llvm/Analysis/AliasAnalysis.h
  llvm/lib/Analysis/AliasAnalysis.cpp
  llvm/test/Analysis/BasicAA/noalias-param.ll


Index: llvm/test/Analysis/BasicAA/noalias-param.ll
===================================================================
--- llvm/test/Analysis/BasicAA/noalias-param.ll
+++ llvm/test/Analysis/BasicAA/noalias-param.ll
@@ -22,9 +22,9 @@
   ret void
 }
 
-; TODO: Result should be the same for byval instead of noalias.
+; Result should be the same for byval instead of noalias.
 ; CHECK-LABEL: byval
-; CHECK: MayAlias: i32* %a, i32* %b
+; CHECK: NoAlias: i32* %a, i32* %b
 define void @byval(i32* byval(i32) %a, i32* %b) nounwind {
 entry:
   store i32 1, i32* %a
Index: llvm/lib/Analysis/AliasAnalysis.cpp
===================================================================
--- llvm/lib/Analysis/AliasAnalysis.cpp
+++ llvm/lib/Analysis/AliasAnalysis.cpp
@@ -943,9 +943,9 @@
   return false;
 }
 
-bool llvm::isNoAliasArgument(const Value *V) {
+static bool isNoAliasOrByValArgument(const Value *V) {
   if (const Argument *A = dyn_cast<Argument>(V))
-    return A->hasNoAliasAttr();
+    return A->hasNoAliasAttr() || A->hasByValAttr();
   return false;
 }
 
@@ -956,13 +956,13 @@
     return true;
   if (isNoAliasCall(V))
     return true;
-  if (const Argument *A = dyn_cast<Argument>(V))
-    return A->hasNoAliasAttr() || A->hasByValAttr();
+  if (isNoAliasOrByValArgument(V))
+    return true;
   return false;
 }
 
 bool llvm::isIdentifiedFunctionLocal(const Value *V) {
-  return isa<AllocaInst>(V) || isNoAliasCall(V) || isNoAliasArgument(V);
+  return isa<AllocaInst>(V) || isNoAliasCall(V) || isNoAliasOrByValArgument(V);
 }
 
 void llvm::getAAResultsAnalysisUsage(AnalysisUsage &AU) {
Index: llvm/include/llvm/Analysis/AliasAnalysis.h
===================================================================
--- llvm/include/llvm/Analysis/AliasAnalysis.h
+++ llvm/include/llvm/Analysis/AliasAnalysis.h
@@ -1097,9 +1097,6 @@
 /// Return true if this pointer is returned by a noalias function.
 bool isNoAliasCall(const Value *V);
 
-/// Return true if this is an argument with the noalias attribute.
-bool isNoAliasArgument(const Value *V);
-
 /// Return true if this pointer refers to a distinct and identifiable object.
 /// This returns true for:
 ///    Global Variables and Functions (but not Global Aliases)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D93602.313161.patch
Type: text/x-patch
Size: 2218 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201221/0a67e674/attachment.bin>


More information about the llvm-commits mailing list