[PATCH] D130896: [AA] Tracking per-location ModRef info in FunctionModRefBehavior (NFCI)

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 1 05:44:30 PDT 2022


nikic created this revision.
nikic added reviewers: asbirlea, fhahn, jdoerfert, reames.
Herald added a reviewer: bollu.
Herald added subscribers: jeroen.dobbelaere, ormris, steven_wu, hiraditya.
Herald added a project: All.
nikic requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Currently, FunctionModRefBehavior tracks whether the function reads or writes memory (ModRefInfo) and which locations it can access (argmem, inaccessiblemem and other). This patch changes it to track ModRef information per-location instead.

To give two examples of why this is useful:

- D117095 <https://reviews.llvm.org/D117095> highlights a weakness of ModRef modelling in the presence of operand bundled. For a memcpy call with deopt operand bundle, we want to say that it can read and write argument memory, but only read other memory. This would allow them to be treated like any other calls. However, we currently can't express this and have to say that it can read or write any memory. (cc @ebrevnov)
- D127383 <https://reviews.llvm.org/D127383> would ideally be modelled as a separate threadid location, where threadid Refs outside pre-split coroutines can be ignored (like other accesses to constant memory). The current representation does not allow modelling this precisely. (cc @ChuanqiXu)

The patch as implemented is intended to be NFC, but there are some obvious opportunities for improvements and simplification. To fully capitalize on this we would also want to change the way we represent memory attributes on functions, but that's a larger change, and I think it makes sense to separate out the FunctionModRefBehavior refactoring.


https://reviews.llvm.org/D130896

Files:
  llvm/include/llvm/Analysis/AliasAnalysis.h
  llvm/lib/Analysis/AliasAnalysis.cpp
  llvm/lib/Analysis/AliasSetTracker.cpp
  llvm/lib/Analysis/BasicAliasAnalysis.cpp
  llvm/lib/Analysis/GlobalsModRef.cpp
  llvm/lib/Analysis/ObjCARCAliasAnalysis.cpp
  llvm/lib/Analysis/TypeBasedAliasAnalysis.cpp
  llvm/lib/Transforms/IPO/FunctionAttrs.cpp
  llvm/lib/Transforms/IPO/ThinLTOBitcodeWriter.cpp
  llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp
  llvm/lib/Transforms/ObjCARC/DependencyAnalysis.cpp
  llvm/lib/Transforms/Scalar/LICM.cpp
  llvm/lib/Transforms/Utils/InlineFunction.cpp
  llvm/unittests/Analysis/GlobalsModRefTest.cpp
  polly/lib/Analysis/ScopBuilder.cpp
  polly/lib/Analysis/ScopDetection.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D130896.448998.patch
Type: text/x-patch
Size: 42137 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220801/41d8b853/attachment.bin>


More information about the llvm-commits mailing list