<div dir="ltr">Note:, the example would optimize if it was multiple blocks with an if.<div><br></div><div>The problem with assume is two fold:<br><br></div><div>1. Their is not proper control dependence infrastructure to know not to move them, we rely on marking them as memory touching instructions, which they are not. This causes all sorts of fun side-effects like adding assumes causing things to go from readnone to readonly or readwrite, not just during functionattrs, but during inlining, etc.</div><div><br></div><div>2. Their scope is implicit. Things have to track and figure out what they apply to.</div><div><br></div><div>In extended-ssa (which is basically assume, if the assumes produced a value that was used by things that make use of the information), all use-sites are post-dominated by the conditional.</div><div><br></div><div><br></div><div>IE extended-ssa is something like</div><div><br></div><div>%2 = icmp eq %foo, 3</div><div>%3 = llvm.assume(%foo eq 3)</div><div><use of %3 instead of %foo></div><div><br></div><div>So for conditionals, it will produce two assumes, one in each branch, and all things in that branch using %foo would instead use the result of the assume for that side of the branch.</div><div><br></div><div><br></div><div><br></div><div><br></div><div> </div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jun 10, 2016 at 5:38 PM, Daniel Berlin <span dir="ltr"><<a href="mailto:dberlin@dberlin.org" target="_blank">dberlin@dberlin.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote"><span class="">On Fri, Jun 10, 2016 at 5:34 PM, Lawrence, Peter via llvm-dev <span dir="ltr"><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div lang="EN-US" link="#0563C1" vlink="#954F72">
<div>
<p class="MsoNormal">My (dumb?) question would be: why is llvm.assume being handled any differently than llvm.assert ?</p></div></div></blockquote><div><br></div></span><div>There is no llvm.assert intrinsic, so i'm not sure what you mean here. Care to give an example?</div><span class=""><div> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div lang="EN-US" link="#0563C1" vlink="#954F72"><div><p class="MsoNormal"><u></u><u></u></p>
<p class="MsoNormal">Other than one trapping and one not-trapping, they should be identical, in both cases they are giving<u></u><u></u></p>
<p class="MsoNormal">The optimizers information, and that shouldn’t be any different from being inside an “if” statement with the same condition ?</p></div></div></blockquote><div><br></div><div><br></div></span></div></div></div>
</blockquote></div><br></div>