[all-commits] [llvm/llvm-project] d1186c: [Attributor] Make interprocedural value explicit i...

Johannes Doerfert via All-commits all-commits at lists.llvm.org
Mon Jan 31 23:43:01 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d1186ce7a9bd90c1bc05d5488dbfcbf191f85d99
      https://github.com/llvm/llvm-project/commit/d1186ce7a9bd90c1bc05d5488dbfcbf191f85d99
  Author: Johannes Doerfert <johannes at jdoerfert.de>
  Date:   2022-02-01 (Tue, 01 Feb 2022)

  Changed paths:
    M llvm/include/llvm/Transforms/IPO/Attributor.h
    M llvm/lib/Transforms/IPO/AttributorAttributes.cpp
    M llvm/test/Transforms/Attributor/ArgumentPromotion/2008-02-01-ReturnAttrs.ll
    M llvm/test/Transforms/Attributor/ArgumentPromotion/X86/attributes.ll
    M llvm/test/Transforms/Attributor/ArgumentPromotion/X86/min-legal-vector-width.ll
    M llvm/test/Transforms/Attributor/ArgumentPromotion/alignment.ll
    M llvm/test/Transforms/Attributor/ArgumentPromotion/array.ll
    M llvm/test/Transforms/Attributor/ArgumentPromotion/basictest.ll
    M llvm/test/Transforms/Attributor/ArgumentPromotion/control-flow2.ll
    M llvm/test/Transforms/Attributor/ArgumentPromotion/live_called_from_dead.ll
    M llvm/test/Transforms/Attributor/ArgumentPromotion/live_called_from_dead_2.ll
    M llvm/test/Transforms/Attributor/ArgumentPromotion/profile.ll
    M llvm/test/Transforms/Attributor/ArgumentPromotion/sret.ll
    M llvm/test/Transforms/Attributor/IPConstantProp/2009-09-24-byval-ptr.ll
    M llvm/test/Transforms/Attributor/IPConstantProp/PR16052.ll
    M llvm/test/Transforms/Attributor/IPConstantProp/musttail-call.ll
    M llvm/test/Transforms/Attributor/IPConstantProp/openmp_parallel_for.ll
    M llvm/test/Transforms/Attributor/callbacks.ll
    M llvm/test/Transforms/Attributor/internal-noalias.ll
    M llvm/test/Transforms/Attributor/memory_locations.ll
    M llvm/test/Transforms/Attributor/nodelete.ll
    M llvm/test/Transforms/Attributor/nonnull.ll
    M llvm/test/Transforms/Attributor/noreturn_async.ll
    M llvm/test/Transforms/Attributor/openmp_parallel.ll
    M llvm/test/Transforms/Attributor/range.ll
    M llvm/test/Transforms/Attributor/read_write_returned_arguments_scc.ll
    M llvm/test/Transforms/Attributor/value-simplify-instances.ll
    M llvm/test/Transforms/Attributor/value-simplify-pointer-info.ll

  Log Message:
  -----------
  [Attributor] Make interprocedural value explicit in genericValueTraversal

genericValueTraversal can look through arguments and allow value
simplification across function boundaries. In fact, the latter already
happened unchecked. With this change we allow the user of
genericValueTraversal to opt-out of interprocedural traversal if
required. We explicitly look through arguments now which helps to do
various things, incl. the propagation of constants into OpenMP parallel
regions (on the host).


  Commit: ac3ec22df90671f40007028abc1544f0e3938cc0
      https://github.com/llvm/llvm-project/commit/ac3ec22df90671f40007028abc1544f0e3938cc0
  Author: Johannes Doerfert <johannes at jdoerfert.de>
  Date:   2022-02-01 (Tue, 01 Feb 2022)

  Changed paths:
    M llvm/include/llvm/Transforms/IPO/Attributor.h
    M llvm/lib/Transforms/IPO/AttributorAttributes.cpp
    M llvm/test/Transforms/Attributor/ArgumentPromotion/2008-02-01-ReturnAttrs.ll
    M llvm/test/Transforms/Attributor/ArgumentPromotion/2008-07-02-array-indexing.ll
    M llvm/test/Transforms/Attributor/ArgumentPromotion/2008-09-07-CGUpdate.ll
    M llvm/test/Transforms/Attributor/ArgumentPromotion/2008-09-08-CGUpdateSelfEdge.ll
    M llvm/test/Transforms/Attributor/ArgumentPromotion/X86/attributes.ll
    M llvm/test/Transforms/Attributor/ArgumentPromotion/aggregate-promote.ll
    M llvm/test/Transforms/Attributor/ArgumentPromotion/alignment.ll
    M llvm/test/Transforms/Attributor/ArgumentPromotion/attrs.ll
    M llvm/test/Transforms/Attributor/ArgumentPromotion/basictest.ll
    M llvm/test/Transforms/Attributor/ArgumentPromotion/byval-2.ll
    M llvm/test/Transforms/Attributor/ArgumentPromotion/byval.ll
    M llvm/test/Transforms/Attributor/ArgumentPromotion/chained.ll
    M llvm/test/Transforms/Attributor/ArgumentPromotion/control-flow.ll
    M llvm/test/Transforms/Attributor/ArgumentPromotion/control-flow2.ll
    M llvm/test/Transforms/Attributor/ArgumentPromotion/crash.ll
    M llvm/test/Transforms/Attributor/ArgumentPromotion/fp80.ll
    M llvm/test/Transforms/Attributor/ArgumentPromotion/inalloca.ll
    M llvm/test/Transforms/Attributor/ArgumentPromotion/invalidation.ll
    M llvm/test/Transforms/Attributor/ArgumentPromotion/live_called_from_dead.ll
    M llvm/test/Transforms/Attributor/ArgumentPromotion/live_called_from_dead_2.ll
    M llvm/test/Transforms/Attributor/ArgumentPromotion/musttail.ll
    M llvm/test/Transforms/Attributor/ArgumentPromotion/naked_functions.ll
    M llvm/test/Transforms/Attributor/ArgumentPromotion/pr32917.ll
    M llvm/test/Transforms/Attributor/ArgumentPromotion/pr33641_remove_arg_dbgvalue.ll
    M llvm/test/Transforms/Attributor/ArgumentPromotion/reserve-tbaa.ll
    M llvm/test/Transforms/Attributor/ArgumentPromotion/sret.ll
    M llvm/test/Transforms/Attributor/IPConstantProp/2008-06-09-WeakProp.ll
    M llvm/test/Transforms/Attributor/IPConstantProp/2009-09-24-byval-ptr.ll
    M llvm/test/Transforms/Attributor/IPConstantProp/PR16052.ll
    M llvm/test/Transforms/Attributor/IPConstantProp/PR26044.ll
    M llvm/test/Transforms/Attributor/IPConstantProp/PR43857.ll
    M llvm/test/Transforms/Attributor/IPConstantProp/arg-count-mismatch.ll
    M llvm/test/Transforms/Attributor/IPConstantProp/arg-type-mismatch.ll
    M llvm/test/Transforms/Attributor/IPConstantProp/comdat-ipo.ll
    M llvm/test/Transforms/Attributor/IPConstantProp/dangling-block-address.ll
    M llvm/test/Transforms/Attributor/IPConstantProp/deadarg.ll
    M llvm/test/Transforms/Attributor/IPConstantProp/fp-bc-icmp-const-fold.ll
    M llvm/test/Transforms/Attributor/IPConstantProp/global.ll
    M llvm/test/Transforms/Attributor/IPConstantProp/multiple_callbacks.ll
    M llvm/test/Transforms/Attributor/IPConstantProp/naked-return.ll
    M llvm/test/Transforms/Attributor/IPConstantProp/openmp_parallel_for.ll
    M llvm/test/Transforms/Attributor/IPConstantProp/pthreads.ll
    M llvm/test/Transforms/Attributor/IPConstantProp/recursion.ll
    M llvm/test/Transforms/Attributor/IPConstantProp/remove-call-inst.ll
    M llvm/test/Transforms/Attributor/IPConstantProp/return-argument.ll
    M llvm/test/Transforms/Attributor/IPConstantProp/return-constant.ll
    M llvm/test/Transforms/Attributor/IPConstantProp/return-constants.ll
    M llvm/test/Transforms/Attributor/IPConstantProp/solve-after-each-resolving-undefs-for-function.ll
    M llvm/test/Transforms/Attributor/IPConstantProp/thread_local_acs.ll
    M llvm/test/Transforms/Attributor/align.ll
    M llvm/test/Transforms/Attributor/allow_list.ll
    M llvm/test/Transforms/Attributor/alwaysinline.ll
    M llvm/test/Transforms/Attributor/cb_liveness_disabled.ll
    M llvm/test/Transforms/Attributor/cb_liveness_enabled.ll
    M llvm/test/Transforms/Attributor/cb_range_disabled.ll
    M llvm/test/Transforms/Attributor/cb_range_enabled.ll
    M llvm/test/Transforms/Attributor/depgraph.ll
    M llvm/test/Transforms/Attributor/dereferenceable-1.ll
    M llvm/test/Transforms/Attributor/dereferenceable-2-inseltpoison.ll
    M llvm/test/Transforms/Attributor/dereferenceable-2.ll
    M llvm/test/Transforms/Attributor/heap_to_stack.ll
    M llvm/test/Transforms/Attributor/heap_to_stack_gpu.ll
    M llvm/test/Transforms/Attributor/internal-noalias.ll
    M llvm/test/Transforms/Attributor/internalize.ll
    M llvm/test/Transforms/Attributor/liveness.ll
    M llvm/test/Transforms/Attributor/liveness_chains.ll
    M llvm/test/Transforms/Attributor/lvi-after-jumpthreading.ll
    M llvm/test/Transforms/Attributor/lvi-for-ashr.ll
    M llvm/test/Transforms/Attributor/memory_locations.ll
    M llvm/test/Transforms/Attributor/misc.ll
    M llvm/test/Transforms/Attributor/misc_crash.ll
    M llvm/test/Transforms/Attributor/noalias.ll
    M llvm/test/Transforms/Attributor/nocapture-1.ll
    M llvm/test/Transforms/Attributor/nocapture-2.ll
    M llvm/test/Transforms/Attributor/nodelete.ll
    M llvm/test/Transforms/Attributor/nofree.ll
    M llvm/test/Transforms/Attributor/nonnull.ll
    M llvm/test/Transforms/Attributor/norecurse.ll
    M llvm/test/Transforms/Attributor/noreturn.ll
    M llvm/test/Transforms/Attributor/nosync.ll
    M llvm/test/Transforms/Attributor/nounwind.ll
    M llvm/test/Transforms/Attributor/openmp_parallel.ll
    M llvm/test/Transforms/Attributor/potential.ll
    M llvm/test/Transforms/Attributor/range.ll
    M llvm/test/Transforms/Attributor/read_write_returned_arguments_scc.ll
    M llvm/test/Transforms/Attributor/readattrs.ll
    M llvm/test/Transforms/Attributor/returned.ll
    M llvm/test/Transforms/Attributor/undefined_behavior.ll
    M llvm/test/Transforms/Attributor/value-simplify-instances.ll
    M llvm/test/Transforms/Attributor/value-simplify-pointer-info.ll
    M llvm/test/Transforms/Attributor/value-simplify.ll
    M llvm/test/Transforms/Attributor/willreturn.ll
    M llvm/test/Transforms/Attributor/wrapper.ll
    M llvm/test/Transforms/OpenMP/custom_state_machines.ll
    M llvm/test/Transforms/OpenMP/remove_globalization.ll
    M llvm/test/Transforms/OpenMP/replace_globalization.ll
    M llvm/test/Transforms/OpenMP/spmdization.ll
    M llvm/test/Transforms/OpenMP/spmdization_guarding_two_reaching_kernels.ll

  Log Message:
  -----------
  [Attributor] Use AAFunctionReachability to determine AANoRecurse

We missed out on AANoRecurse in the module pass because we had no call
graph. With AAFunctionReachability we can simply ask if the function may
reach itself.

Differential Revision: https://reviews.llvm.org/D110099


  Commit: b2d1ae061153b2364f15f58ee00e46b49bad3544
      https://github.com/llvm/llvm-project/commit/b2d1ae061153b2364f15f58ee00e46b49bad3544
  Author: Kuter Dinel <kuterdinel at gmail.com>
  Date:   2022-02-01 (Tue, 01 Feb 2022)

  Changed paths:
    M llvm/include/llvm/Transforms/IPO/Attributor.h
    M llvm/lib/Transforms/IPO/AttributorAttributes.cpp
    M llvm/unittests/Transforms/IPO/AttributorTest.cpp

  Log Message:
  -----------
  [Attributor] AAFunctionReachability, Instruction reachability.

This patch implement instruction reachability for AAFunctionReachability
attribute. It is used to tell if a certain instruction can reach a function
transitively.

NOTE: I created a new commit based of D106720 and set the author back to
      Kuter. Other metadata, etc. is wrong. I also addressed the
      remaining review comments and fixed the unit test.

Differential Revision: https://reviews.llvm.org/D106720


  Commit: 09802f84585506b222926db199a09e3c5e5cc7a9
      https://github.com/llvm/llvm-project/commit/09802f84585506b222926db199a09e3c5e5cc7a9
  Author: Johannes Doerfert <johannes at jdoerfert.de>
  Date:   2022-02-01 (Tue, 01 Feb 2022)

  Changed paths:
    A llvm/test/Transforms/Attributor/value-simplify-gpu.ll

  Log Message:
  -----------
  [Attributor] Pre-commit test case

This test shows how we can use alloca position and kernel+AS information
to improve reachability queries and consequently store-load forwarding.

The thirst argument passed to the @use function can be determined
statically (a constant). The others cannot and are there for
verification.


  Commit: b51b83f68e4671a508021911a5b2cf124f493d25
      https://github.com/llvm/llvm-project/commit/b51b83f68e4671a508021911a5b2cf124f493d25
  Author: Johannes Doerfert <johannes at jdoerfert.de>
  Date:   2022-02-01 (Tue, 01 Feb 2022)

  Changed paths:
    M llvm/include/llvm/Transforms/IPO/Attributor.h
    M llvm/lib/Transforms/IPO/Attributor.cpp
    M llvm/lib/Transforms/IPO/AttributorAttributes.cpp
    M llvm/test/Transforms/Attributor/ArgumentPromotion/2008-07-02-array-indexing.ll
    M llvm/test/Transforms/Attributor/ArgumentPromotion/2008-09-07-CGUpdate.ll
    M llvm/test/Transforms/Attributor/ArgumentPromotion/2008-09-08-CGUpdateSelfEdge.ll
    M llvm/test/Transforms/Attributor/ArgumentPromotion/X86/attributes.ll
    M llvm/test/Transforms/Attributor/ArgumentPromotion/aggregate-promote.ll
    M llvm/test/Transforms/Attributor/ArgumentPromotion/attrs.ll
    M llvm/test/Transforms/Attributor/ArgumentPromotion/byval-2.ll
    M llvm/test/Transforms/Attributor/ArgumentPromotion/byval.ll
    M llvm/test/Transforms/Attributor/ArgumentPromotion/chained.ll
    M llvm/test/Transforms/Attributor/ArgumentPromotion/control-flow.ll
    M llvm/test/Transforms/Attributor/ArgumentPromotion/control-flow2.ll
    M llvm/test/Transforms/Attributor/ArgumentPromotion/dbg.ll
    M llvm/test/Transforms/Attributor/ArgumentPromotion/fp80.ll
    M llvm/test/Transforms/Attributor/ArgumentPromotion/inalloca.ll
    M llvm/test/Transforms/Attributor/ArgumentPromotion/live_called_from_dead.ll
    M llvm/test/Transforms/Attributor/ArgumentPromotion/live_called_from_dead_2.ll
    M llvm/test/Transforms/Attributor/ArgumentPromotion/musttail.ll
    M llvm/test/Transforms/Attributor/ArgumentPromotion/naked_functions.ll
    M llvm/test/Transforms/Attributor/ArgumentPromotion/nonzero-address-spaces.ll
    M llvm/test/Transforms/Attributor/ArgumentPromotion/pr27568.ll
    M llvm/test/Transforms/Attributor/ArgumentPromotion/pr32917.ll
    M llvm/test/Transforms/Attributor/ArgumentPromotion/pr33641_remove_arg_dbgvalue.ll
    M llvm/test/Transforms/Attributor/ArgumentPromotion/profile.ll
    M llvm/test/Transforms/Attributor/ArgumentPromotion/reserve-tbaa.ll
    M llvm/test/Transforms/Attributor/ArgumentPromotion/sret.ll
    M llvm/test/Transforms/Attributor/ArgumentPromotion/variadic.ll
    M llvm/test/Transforms/Attributor/IPConstantProp/2008-06-09-WeakProp.ll
    M llvm/test/Transforms/Attributor/IPConstantProp/2009-09-24-byval-ptr.ll
    M llvm/test/Transforms/Attributor/IPConstantProp/PR16052.ll
    M llvm/test/Transforms/Attributor/IPConstantProp/PR26044.ll
    M llvm/test/Transforms/Attributor/IPConstantProp/PR43857.ll
    M llvm/test/Transforms/Attributor/IPConstantProp/arg-count-mismatch.ll
    M llvm/test/Transforms/Attributor/IPConstantProp/arg-type-mismatch.ll
    M llvm/test/Transforms/Attributor/IPConstantProp/comdat-ipo.ll
    M llvm/test/Transforms/Attributor/IPConstantProp/dangling-block-address.ll
    M llvm/test/Transforms/Attributor/IPConstantProp/deadarg.ll
    M llvm/test/Transforms/Attributor/IPConstantProp/fp-bc-icmp-const-fold.ll
    M llvm/test/Transforms/Attributor/IPConstantProp/global.ll
    M llvm/test/Transforms/Attributor/IPConstantProp/multiple_callbacks.ll
    M llvm/test/Transforms/Attributor/IPConstantProp/naked-return.ll
    M llvm/test/Transforms/Attributor/IPConstantProp/openmp_parallel_for.ll
    M llvm/test/Transforms/Attributor/IPConstantProp/pthreads.ll
    M llvm/test/Transforms/Attributor/IPConstantProp/recursion.ll
    M llvm/test/Transforms/Attributor/IPConstantProp/remove-call-inst.ll
    M llvm/test/Transforms/Attributor/IPConstantProp/return-argument.ll
    M llvm/test/Transforms/Attributor/IPConstantProp/return-constants.ll
    M llvm/test/Transforms/Attributor/IPConstantProp/thread_local_acs.ll
    M llvm/test/Transforms/Attributor/alwaysinline.ll
    M llvm/test/Transforms/Attributor/cb_liveness_disabled.ll
    M llvm/test/Transforms/Attributor/cb_liveness_enabled.ll
    M llvm/test/Transforms/Attributor/cb_range_disabled.ll
    M llvm/test/Transforms/Attributor/cb_range_enabled.ll
    M llvm/test/Transforms/Attributor/dereferenceable-2-inseltpoison.ll
    M llvm/test/Transforms/Attributor/dereferenceable-2.ll
    M llvm/test/Transforms/Attributor/internalize.ll
    M llvm/test/Transforms/Attributor/liveness.ll
    M llvm/test/Transforms/Attributor/liveness_chains.ll
    M llvm/test/Transforms/Attributor/lowerheap.ll
    M llvm/test/Transforms/Attributor/lvi-for-ashr.ll
    M llvm/test/Transforms/Attributor/misc.ll
    M llvm/test/Transforms/Attributor/noalias.ll
    M llvm/test/Transforms/Attributor/noreturn.ll
    M llvm/test/Transforms/Attributor/nosync.ll
    M llvm/test/Transforms/Attributor/noundef.ll
    M llvm/test/Transforms/Attributor/nounwind.ll
    M llvm/test/Transforms/Attributor/openmp_parallel.ll
    M llvm/test/Transforms/Attributor/potential.ll
    M llvm/test/Transforms/Attributor/range.ll
    M llvm/test/Transforms/Attributor/reduced/register_benchmark_test.ll
    M llvm/test/Transforms/Attributor/returned.ll
    M llvm/test/Transforms/Attributor/undefined_behavior.ll
    M llvm/test/Transforms/Attributor/value-simplify-gpu.ll
    M llvm/test/Transforms/Attributor/value-simplify-instances.ll
    M llvm/test/Transforms/Attributor/value-simplify-pointer-info.ll
    M llvm/test/Transforms/Attributor/value-simplify.ll
    M llvm/test/Transforms/Attributor/wrapper.ll

  Log Message:
  -----------
  [Attributor] Introduce the concept of query AAs

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.

As an alternative to D110078, which forced eager computation where we
want to continue to be lazy, this patch fixes the problem.

QueryAAs are AAs that allow lazy queries during their lifetime. They are
never fixed if they have no outstanding dependences and always run as
part of the updates in an iteration. To determine if we are done, all
query AAs are asked if they received new queries, if not, we only need
to consider updated AAs, as before. If new queries are present we go for
another iteration.

Differential Revision: https://reviews.llvm.org/D118669


  Commit: a265cf22af5ec7d1319f690126b6479e356ef270
      https://github.com/llvm/llvm-project/commit/a265cf22af5ec7d1319f690126b6479e356ef270
  Author: Johannes Doerfert <johannes at jdoerfert.de>
  Date:   2022-02-01 (Tue, 01 Feb 2022)

  Changed paths:
    M llvm/include/llvm/Transforms/IPO/Attributor.h
    M llvm/lib/Transforms/IPO/Attributor.cpp
    M llvm/lib/Transforms/IPO/AttributorAttributes.cpp
    M llvm/test/Transforms/Attributor/ArgumentPromotion/X86/min-legal-vector-width.ll
    M llvm/test/Transforms/Attributor/ArgumentPromotion/alignment.ll
    M llvm/test/Transforms/Attributor/ArgumentPromotion/basictest.ll
    M llvm/test/Transforms/Attributor/read_write_returned_arguments_scc.ll
    M llvm/test/Transforms/Attributor/value-simplify-gpu.ll

  Log Message:
  -----------
  [Attributor] Introduce the `AA::isPotentiallyReachable` helper APIs

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) 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.

Differential Revision: https://reviews.llvm.org/D118673


Compare: https://github.com/llvm/llvm-project/compare/9b078f8fd26a...a265cf22af5e


More information about the All-commits mailing list