<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Oct 19, 2016 at 5:01 PM, Mehdi Amini <span dir="ltr"><<a href="mailto:mehdi.amini@apple.com" target="_blank">mehdi.amini@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><br><div><span class=""><blockquote type="cite"><div>On Oct 19, 2016, at 7:06 AM, Alexandre Isoard via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:</div><br class="m_-4907530952721243308Apple-interchange-newline"><div><div dir="ltr" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><div class="gmail_extra"><br class="m_-4907530952721243308Apple-interchange-newline"><br><div class="gmail_quote">On Tue, Oct 18, 2016 at 9:12 PM, Sanjoy Das via llvm-dev<span class="m_-4907530952721243308Apple-converted-space"> </span><span dir="ltr"><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.<wbr>org</a>></span><span class="m_-4907530952721243308Apple-converted-space"> </span>wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Hi Krzysztof,<br><br>freeze(poison) is different from undef today, in the sense that it is an instruction that produces some random, but fixed bit pattern.<br><br>E.g. today in<br><br> <span class="m_-4907530952721243308Apple-converted-space"> </span>%x = undef<br> <span class="m_-4907530952721243308Apple-converted-space"> </span>%y = xor %x, %x<br><br>we can fold %y to undef since each use of %x can independently see some arbitrary (up to the compiler / environment) bit pattern.<br></blockquote><div>We can also fold it to %y = 0 if we want, isn't it? </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><br>But in the new proposal, in:<br><br> <span class="m_-4907530952721243308Apple-converted-space"> </span>%x = freeze(poison)<br> <span class="m_-4907530952721243308Apple-converted-space"> </span>%y = xor %x, %x<br><br>that is no longer allowed (%y _has_ to be 0) -- all uses of %x will see some garbage, but fixed bit pattern.<br></blockquote><div>What is the real motivation behind introducing a new kind of undef?</div><div><br></div><div>I remember having read that undef does not obey all the rules of SSA. That is, a variable %x set to undef is in fact not initialized at it's definition but at each of it's use instead. Which is an argument I never quite understood, because the nature of undef is that we can safely restrict ourself to a classic aproach where %x has the same value at each use (as the compiler is free to assign any value to any undef it encounter). This does not exploit all of the freedom offered by undef, but is always valid, isn't it?</div></div></div></div></div></blockquote><div><br></div></span><div>Even if you wanted to do this (use the same “undef” for every use of %x), how can you do since undef is a constant? For example:</div><span class=""><div><br></div><div> %y = xor %x, %x<br></div></span><div>and:</div><div> %y = xor %x, %z<br></div><div><br></div><div>If %x and %z are undef you can’t differentiate these anymore:</div><div><br></div><div><div> %y = xor undef, undef</div></div></div></div></blockquote><div><br></div><div>I am probably missing something important, but what I mean is that you can always convert:</div><div><br></div><div>%y = xor %x, %x</div><div>to</div><div>%y = 0</div><div><br></div><div>Regardless of if %x is/might be an undef. That is, consider that reading %x any number of times always give the value of its definition (as SSA suggest). Therefore, disregarding the special semantic of undef (which is always safe in this direction).</div><div><br></div><div>Is there an example of transformation which is forbidden by the fact that a variable might be undef?</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div><div><div><br></div><div>— </div><span class="HOEnZb"><font color="#888888"><div>Mehdi</div><div><br></div></font></span></div></div></div></blockquote></div><br>In other words, can I do transformations in llvm assuming undef follow the expected SSA semantic? That is, if I do a transformation that is valid for any value of %x, will it be valid for when %x is undef?<br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><b>Alexandre Isoard</b><br></div></div>
</div></div>