[PATCH] D110078: [Attributor] Merge D106720 and AACallEdges

Johannes Doerfert via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 20 09:34:05 PDT 2021


jdoerfert created this revision.
jdoerfert added a reviewer: kuter.
Herald added subscribers: ormris, foad, okura, uenoku, kerbowa, arphaman, bollu, hiraditya, nhaehnle, jvesely, arsenm.
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.

With three reachability related AAs things got complicated. D106720 <https://reviews.llvm.org/D106720>
introduced features that did not work properly as we could add new
queries after a fixpoint was reached and which could not be answered by
the information gathered up to the fixpoint alone.

This patch merges D106720 <https://reviews.llvm.org/D106720> and AACallEdges to simplify the situation.
It also moves the "backwards" reachability out of D106720 <https://reviews.llvm.org/D106720> and into
`AA::isPotentiallyReachable`. In addition to avoiding the fixpoint issue
described above, the new scheme allows to track reachability in one
place only. We do not have to redo work for backwards queries as the
caller already caches reachability. Asking the caller explicitly is the
right way to go here.

To test inter-procedural reachability in a reasonable way this patch
includes also 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. See `value-simplify-pointer-info-gpu.ll`.

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


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D110078

Files:
  llvm/include/llvm/Transforms/IPO/Attributor.h
  llvm/lib/Target/AMDGPU/AMDGPUAttributor.cpp
  llvm/lib/Transforms/IPO/Attributor.cpp
  llvm/lib/Transforms/IPO/AttributorAttributes.cpp
  llvm/test/Transforms/Attributor/ArgumentPromotion/2008-02-01-ReturnAttrs.ll
  llvm/test/Transforms/Attributor/ArgumentPromotion/2008-07-02-array-indexing.ll
  llvm/test/Transforms/Attributor/ArgumentPromotion/alignment.ll
  llvm/test/Transforms/Attributor/ArgumentPromotion/attrs.ll
  llvm/test/Transforms/Attributor/ArgumentPromotion/basictest.ll
  llvm/test/Transforms/Attributor/ArgumentPromotion/byval-2.ll
  llvm/test/Transforms/Attributor/ArgumentPromotion/byval.ll
  llvm/test/Transforms/Attributor/ArgumentPromotion/control-flow.ll
  llvm/test/Transforms/Attributor/ArgumentPromotion/control-flow2.ll
  llvm/test/Transforms/Attributor/ArgumentPromotion/crash.ll
  llvm/test/Transforms/Attributor/ArgumentPromotion/inalloca.ll
  llvm/test/Transforms/Attributor/ArgumentPromotion/live_called_from_dead.ll
  llvm/test/Transforms/Attributor/ArgumentPromotion/live_called_from_dead_2.ll
  llvm/test/Transforms/Attributor/ArgumentPromotion/musttail.ll
  llvm/test/Transforms/Attributor/ArgumentPromotion/pr32917.ll
  llvm/test/Transforms/Attributor/ArgumentPromotion/reserve-tbaa.ll
  llvm/test/Transforms/Attributor/ArgumentPromotion/sret.ll
  llvm/test/Transforms/Attributor/IPConstantProp/2009-09-24-byval-ptr.ll
  llvm/test/Transforms/Attributor/IPConstantProp/return-argument.ll
  llvm/test/Transforms/Attributor/IPConstantProp/return-constants.ll
  llvm/test/Transforms/Attributor/align.ll
  llvm/test/Transforms/Attributor/dereferenceable-1.ll
  llvm/test/Transforms/Attributor/internal-noalias.ll
  llvm/test/Transforms/Attributor/liveness.ll
  llvm/test/Transforms/Attributor/memory_locations.ll
  llvm/test/Transforms/Attributor/misc.ll
  llvm/test/Transforms/Attributor/noalias.ll
  llvm/test/Transforms/Attributor/nodelete.ll
  llvm/test/Transforms/Attributor/norecurse.ll
  llvm/test/Transforms/Attributor/potential.ll
  llvm/test/Transforms/Attributor/range.ll
  llvm/test/Transforms/Attributor/value-simplify-pointer-info.ll
  llvm/test/Transforms/Attributor/value-simplify.ll
  llvm/test/Transforms/OpenMP/custom_state_machines.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D110078.373621.patch
Type: text/x-patch
Size: 218283 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210920/e9fdc394/attachment-0001.bin>


More information about the llvm-commits mailing list