[PATCH] D118673: [Attributor] Introduce the `AA::isPotentiallyReachable` helper APIs

Johannes Doerfert via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 31 18:24:04 PST 2022


jdoerfert created this revision.
jdoerfert added a reviewer: kuter.
Herald added subscribers: ormris, okura, uenoku, bollu, hiraditya.
Herald added a reviewer: uenoku.
Herald added a reviewer: homerdin.
jdoerfert requested review of this revision.
Herald added a reviewer: sstefan1.
Herald added a reviewer: baziotis.
Herald added a project: LLVM.

To make usage easier (compared to the many reachability related AAs),
this patch introduces a helper API, `AA::isPotentiallyReachable`, which
performs all the necessary steps. It also does the "backwards"
reachability (see D106720 <https://reviews.llvm.org/D106720>) as that simplifies the AA a lot (backwards
queries were somewhat different from the other query resolvers), and
ensures we use cached values in every stage.

To test inter-procedural reachability in a reasonable way this patch
includes an extension to `AAPointerInfo::forallInterferingWrites`.
Basically, we can exclude writes if they cannot reach a load "during the
lifetime" of the allocation. That is, we need to go up the call graph to
determine reachability until we can determine the allocation would be
dead in the caller. This leads to new constant propagations (through
memory) in `value-simplify-pointer-info-gpu.ll`.

Note: The new code contains plenty debug output to determine how
reachability queries are resolved.

Parts extracted from D110078 <https://reviews.llvm.org/D110078>.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D118673

Files:
  llvm/include/llvm/Transforms/IPO/Attributor.h
  llvm/lib/Transforms/IPO/Attributor.cpp
  llvm/lib/Transforms/IPO/AttributorAttributes.cpp
  llvm/test/Transforms/Attributor/ArgumentPromotion/alignment.ll
  llvm/test/Transforms/Attributor/ArgumentPromotion/basictest.ll
  llvm/test/Transforms/Attributor/ArgumentPromotion/byval.ll
  llvm/test/Transforms/Attributor/read_write_returned_arguments_scc.ll
  llvm/test/Transforms/Attributor/value-simplify-gpu.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D118673.404778.patch
Type: text/x-patch
Size: 64001 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220201/1971c12c/attachment.bin>


More information about the llvm-commits mailing list