<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p>Hi, Johannes,</p>
    <p>I'm certainly in favor of rewriting the attribute deduction so
      that it's more consistent and more powerful. There's a lot more
      that we could do. I'll help to review the patches.<br>
    </p>
    <div class="moz-cite-prefix">On 08/23/2018 10:25 AM, Johannes
      Doerfert via llvm-dev wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:20180823152518.GA2956@arch-linux-jd">
      <pre wrap="">After I spend some time working with the function attribute* deduction
pass** [1,3], I would like to propose a "proper" organization***.



Why?

  Because we do not derive nearly as many attributes as we could****,
  while we do maintain various (separate and diffently organized)
  "data-flow-like analyses" to do so.



What else?

  I propose a single optimistic data-flow (fixpoint) loop to perform the
  deduction (similar to [2,3] but for all propagation forms and not only
  call sites -> callee).</pre>
    </blockquote>
    <br>
    Right now, as I recall, we apply an optimistic fixed-point
    optimization to each SCC, moving up the call graph from leaves to
    root. When you say that you want a more-general inference, besides
    just call sites -> callees (and the existing callees ->
    callers), can you please elaborate? Doing both of these at the same
    time as part of a optimistic fixed-point optimization seems to imply
    that the iteration will involve the entire call graph at once (or,
    at least, each connected component at once). Is that what you have
    in mind?<br>
    <br>
    <blockquote type="cite"
      cite="mid:20180823152518.GA2956@arch-linux-jd">
      <pre wrap=""> Given that a pessimistic initialization allows
  to terminate early, we can then also vary the compile time investment.</pre>
    </blockquote>
    <br>
    This is certainly a true statement, but I don't understand what
    you're proposing. Are you saying that we should have both an
    optimistic and pessimistic mode?<br>
    <br>
    Thanks again,<br>
    Hal<br>
    <br>
    <blockquote type="cite"
      cite="mid:20180823152518.GA2956@arch-linux-jd">
      <pre wrap="">



Where is the catch?

  It will require a substantial rewrite with (some) parts that cannot be
  split in small independent patches. While I believe these to be easy
  to review*****, I want to know if
    (1) there is interest in having better attribute deduction, and
    (2) there are volunteers to review such patches.



I do appreciate any input on this proposal.

Cheers,
  Johannes

--------

* It derives function attributes but also parameter and argument
  attributes.

** lib/Transforms/IPO/FunctionAttrs.cpp

*** This statement is intended to sound harsh. I believe it to be
    appropriate because it is hard to find consistency in the current
    implementation. Different parts perform argument deduction similarly
    but still different. This does lead to code duplication and missed
    deductions as there is no information exchange going on.

****  This includes missing attributes in existing propagations
      e.g., dereferencability (see also [0,1]), missing forms of
      propagation, e.g., call sites -> callee (see [2,3]), as well as
      missing deductions due to the fact that there is no (global)
      fixpoint iteration. Additional examples to showcase some current
      shortcomings are attached to this mail.

***** In the sense that they will "just contain" the implementation of a
      fixpoint data-flow analysis. The logic to determine/eliminate
      attributes will be similar to the one we have now.


[0] <a class="moz-txt-link-freetext" href="https://reviews.llvm.org/D48387">https://reviews.llvm.org/D48387</a>
[1] <a class="moz-txt-link-freetext" href="https://reviews.llvm.org/D50107">https://reviews.llvm.org/D50107</a>
[2] <a class="moz-txt-link-freetext" href="https://reviews.llvm.org/D4609">https://reviews.llvm.org/D4609</a>
[3] <a class="moz-txt-link-freetext" href="https://reviews.llvm.org/D50125">https://reviews.llvm.org/D50125</a>

</pre>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
LLVM Developers mailing list
<a class="moz-txt-link-abbreviated" href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>
<a class="moz-txt-link-freetext" href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a>
</pre>
    </blockquote>
    <br>
    <pre class="moz-signature" cols="72">-- 
Hal Finkel
Lead, Compiler Technology and Programming Languages
Leadership Computing Facility
Argonne National Laboratory</pre>
  </body>
</html>