[PATCH] D13992: [AliasAnalysis] Take into account readonly attribute for the function arguments

Igor Laevsky via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 27 17:30:33 PDT 2015


igor-laevsky added inline comments.

================
Comment at: lib/Analysis/BasicAliasAnalysis.cpp:619
@@ -618,1 +618,3 @@
 
+  if (CS.paramHasAttr(ArgIdx + 1, Attribute::ReadOnly))
+    return MRI_Ref;
----------------
hfinkel wrote:
> Don't you need to check all arguments, not just the first? (please add some corresponding test cases)
> 
Other arguments are checked inside the AAResultBase::getModRefInfo. And it seems like this is the only place which uses getArgModRefInfo.

It is indeed incorrect to assume that function does not modify argument memory based on single readonly attribute. However comment in the AAResults::Concept::getArgModRefInfo states that:
```
  /// Note that these bits do not necessarily account for the overall behavior of
  /// the function, but rather only provide additional per-argument
  /// information.
```
So I guess it's fine to leave this check only for single argument.

I have added relevant test case.


http://reviews.llvm.org/D13992





More information about the llvm-commits mailing list