In getArgModRefInfo we consider all arguments as having MRI_ModRef. However for arguments marked with readonly attribute we can return more precise answer - MRI_Ref.
Details
- Reviewers
chandlerc reames hfinkel - Commits
- rG559d1700216e: [AliasAnalysis] Take into account readnone attribute for the function arguments
rG36e84c0fc73a: [AliasAnalysis] Take into account readonly attribute for the function arguments
rL251535: [AliasAnalysis] Take into account readnone attribute for the function arguments
rL251525: [AliasAnalysis] Take into account readonly attribute for the function arguments
Diff Detail
Event Timeline
include/llvm/Analysis/AliasAnalysis.h | ||
---|---|---|
758–759 ↗ | (On Diff #38156) | No, the AA *base* clase should have zero logic. See BasicAAResult for an implementation which does this (and many other things) to provide useful AA information. |
include/llvm/Analysis/AliasAnalysis.h | ||
---|---|---|
758–759 ↗ | (On Diff #38156) | Thanks. It appears that BasicAliasAnalysis does not do this. Please see the updated diff. |
lib/Analysis/BasicAliasAnalysis.cpp | ||
---|---|---|
619 | Don't you need to check all arguments, not just the first? (please add some corresponding test cases) |
lib/Analysis/BasicAliasAnalysis.cpp | ||
---|---|---|
619 | 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. |
LGTM.
In follow-up, it would be nice to handle the ReadNone attribute also.
lib/Analysis/BasicAliasAnalysis.cpp | ||
---|---|---|
619 | Indeed, not sure what I was thinking; thanks for the test case. |
Don't you need to check all arguments, not just the first? (please add some corresponding test cases)