<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jul 22, 2014 at 11:24 AM, Philip Reames <span dir="ltr"><<a href="mailto:listmail@philipreames.com" target="_blank">listmail@philipreames.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="">On 07/22/2014 10:25 AM, Hal Finkel wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
2) When do we remove a llvm.assume? In your test case, you had an<br>
assume which (after the transform) retained a condition about an<br>
otherwise used value (%a). This seems like an obvious case to remove<br>
since we've gotten all the benefit we can from it. Are there other<br>
cases like this we should implement?<br>
</blockquote>
No, I disagree.<br>
</blockquote></div>
This is exactly the discussion we need to be having then.  :)<div class=""><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
We don't want to remove the invariants until after inlining is complete. And for alignment guarantees, for example, we don't want to remove them until after vectorization and unrolling. Currently, they're removed on entry to CodeGen, and it is not clear to me that we need or want to do anything else.<br>

</blockquote></div>
I don't agree with this.  I see several cases where removing them early seems like a good idea.  Consider:<br>
- Once we recognize an assumption and canonicalize it as an attribute, we should immediately remove the assumption.  The assumption conveys no additional information and only limits optimization.  All of the semantic information is available in the attribute.  If your concern is that we loose this information on inlining, then maybe we need to address *that*.<br>

- Once the values which contribute to the assumption become otherwise dead, what does information about those values tell us? It seems like there's no profit to be had by keeping it.  (Thinking about it, my original question/proposal was wrong.  "%a" was a parameter.  There might be later uses of the value after inlining. For discussion, let's pretend "%a" had been the result of a pure function call or something.)</blockquote>
</div><br>I think these are the exceptions rather than the rules?</div><div class="gmail_extra"><br></div><div class="gmail_extra">Essentially, I think that "promoting" an assumption to an attribute clearly supplants the need for the assumption intrinsic. And I think that we should clearly DCE *completely dead* sub-graphs that are being kept alive solely due to the assumption.</div>
</div>