[llvm-dev] IPO & (Function) Attribute Deduction, reviews needed

Doerfert, Johannes via llvm-dev llvm-dev at lists.llvm.org
Mon Apr 1 11:34:27 PDT 2019

In a thread last August [0] I pointed out problems with the current
attribute deduction mess. There are also other threads coming to similar
conclusions, e.g., [1]. I finally found the time to clean up my
replacement pass* and chunk it into logical pieces.

If you are interested in better IPO, attribute deduction is a crucial
first step. Without proper annotations, it is hard for passes like
argument promotion to transform the program.


Before I describe the patches waiting for reviews on phabricator, I want
to note that we'll have a BoF & at least one round table session on IPOs
next week at EuroLLVM. If you are reading this email and attend EurLLVM,
you should consider stopping by!

That said, inputs on discussion topics, etc. are always welcome! Send
them to me, or CC me, so I can make a list.


There are currently 16 patches on Phabricator somehow related to "the
Attributor". If requested, I can split the patches down further. Here is
a complete list:

 1) D59903 [NFC][FnAttrs]  Stress tests for attribute deduction
 2) D59918 [Attributor]    Pass infrastructure and fixpoint framework
 3) D60012 [Attributor]    Introduce bit-encodings for abstract states
 4) D59917 [SelectionDAG]  Allow "returned" arguments to be bit-casted [FIX]
 5) D59919 [Attributor]    Deduce "returned" argument attribute
 6) D59978 [Attributor]    Deduce "no-return" function attribute
 7) D60074 [Attributor]    Deduce "no-recurse" function attribute
 8) D60075 [FunctionAttrs] Remove post order "no-recurse" attribute deduction
 9) D59922 [Attributor]    Deduce "no-capture" argument attribute
10) D59980 [Attributor]    Deduce memory behavior argument attributes
11) D60076 [Attributor]    Deduce memory behavior function attributes
12) D60077 [Attributor]    Deduce memory location function attributes
13) D60078 [FunctionAttrs] Remove old "no-capture" and memory behavior argument deduction
14) D59920 [FunctionAttrs] Remove old "returned" argument deduction
15) D60072 [Attributor]    Deduce "no-capture" attributes for call site arguments
16) D60073 [Attributor]    Enable backwards propagation from callback callees.

The first patch introduces some new tests to showcase problems we have
right now. Additionally, there are two new bugs [2,3] that were exposed
in the process. Patch number 4 [SelectionDAG] fixes the back-end
handling of the returned attribute.

Patches 2 and 3 introduce most of the infrastructure but no deduction.
These tests should be ready for review.

Patches 5,6,7, and 9 introduce deduction for various function and
argument attributes. These tests should be ready for review.

Patches 10,11, and 12 introduce deduction of memory behavior attributes
for arguments and functions, including locations (argmemonly). These
tests lack dedicated tests but are otherwise ready for review.

Patches 8, 13, and 14 remove old functionally made obsolete by the other
patches. Should be straight forward once the dependent patches are

Patches 15 and 16 show one direction of future work, the transparent
handling of abstract call sites [4] (and thereby callbacks [5]). These
tests lack dedicated tests and it is unclear to what degree we want
to actually manifest duplicated attributes (call site + callee).
The code is otherwise clean and can be reviewed

I added some statistics to most of the Phabricator summaries, for more
information, please feel free to ask. All my initial experiments
(performed with earlier versions of some of the patches) showed little
to no change wrt compile and runtime, though I will rerun these with the
latest versions and share the results in the summaries.

I welcome any question and comment!



* "The Attributor", no trademark yet.

[0] https://lists.llvm.org/pipermail/llvm-dev/2018-August/125537.html
[1] http://lists.llvm.org/pipermail/llvm-dev/2018-February/121269.html
[2] https://llvm.org/PR41336
[3] https://llvm.org/PR41328
[4] https://reviews.llvm.org/D54498
[5] https://reviews.llvm.org/D55483


Johannes Doerfert

Argonne National Laboratory
Lemont, IL 60439, USA

jdoerfert at anl.gov
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190401/ac72ffa6/attachment-0001.sig>

More information about the llvm-dev mailing list