<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jan 3, 2017 at 2:29 PM, Xin Tong via Phabricator <span dir="ltr"><<a href="mailto:reviews@reviews.llvm.org" target="_blank">reviews@reviews.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">trentxintong added a comment.<br>
<span class=""><br>
In <a href="https://reviews.llvm.org/D28241#634319" rel="noreferrer" target="_blank">https://reviews.llvm.org/<wbr>D28241#634319</a>, @mkuper wrote:<br>
<br>
> I'm a bit confused about the distinction between "legal" and "safe". I'd assume them to mean the same thing.<br>
<br>
<br>
</span>By "legal" I mean the instructions in question is loop invariant, i.e. every iteration of the loop, same value is produced.<br>
<br>
By "safe" I mean its safe to speculate the instruction, i.e. the compiler will not create a program that faults given a program that does not fault. In case of hoisting, we can guarantee so by either of the isSafeToSpeculativelyExecute or isGuaranteedToExecute.<br>
<br>
I feel word choices can be improved.  "Legal" ==> "Loop Invariant"  and "Safe" ==> "Safe To Execute Unconditionally"<br></blockquote><div><br></div><div>Transformation analyses usually include 'legality' and 'profitability' analysis.  Legality check include both speculation safety and no violations of data dependencies  etc.</div><div><br></div><div>David</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
<br>
<a href="https://reviews.llvm.org/D28241" rel="noreferrer" target="_blank">https://reviews.llvm.org/<wbr>D28241</a><br>
<br>
<br>
<br>
</blockquote></div><br></div></div>