<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Dec 30, 2016 at 10:54 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, Dec 30, 2016 at 10:01 PM, Sanjoy Das <span dir="ltr"><<a href="mailto:sanjoy@playingwithpointers.com" target="_blank">sanjoy@playingwithpointers.<wbr>com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Daniel,<br>
<span><br>
On Fri, Dec 30, 2016 at 9:47 PM, Daniel Berlin <<a href="mailto:dberlin@dberlin.org" target="_blank">dberlin@dberlin.org</a>> wrote:<br>
>><br>
>>>   Is there a case in your algorithm in which treating an<br>
>>> unknown as an undef will be a problem?<br>
>>><br>
</span><span>> Yes, if you try to optimize undefs in any way, no if you move them to<br>
> overdefined :)<br>
><br>
> IE given phi [a, undef, undef, undef]<br>
><br>
> with just as many back edges, you will visit this node 4 times.<br>
><br>
> If you start out with<br>
><br>
> phi [a, undef, undef, undef], you may think "I know, i will make  these<br>
> undef's a".<br>
><br>
> So you move everything to value<br>
><br>
> phi [a, a, a, a]<br>
><br>
> But remember, you really haven't visited the other 4 edges yet, so you don't<br>
> know if this is a valid value for undef (because of the rules around<br>
> and/or/etc, see <a href="http://llvm.org/docs/LangRef.html#undefined-values" rel="noreferrer" target="_blank">http://llvm.org/docs/LangRef.h<wbr>tml#undefined-values</a>).<br>
<br>
</span>But that's the same as case as:<br>
<br>
  %x = phi [a, <unknown>]<br>
<br></blockquote><div> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Unless I know for sure that <unknown> is a, the *final result* can't<br>
report the phi as a. </blockquote></span><div>Right, but we are talking about "when, in the intermediate state, can i transform an undef to a different value".</div><div><br>Remember you can only go down the lattice. So you can't make undef constant, and then discover it's wrong, and go back up :)</div><div>IE  can't change phi undef, undef to constant value 50, , discover 50 doesn't work, and say, well actually, let's make it undef again for an iteration :)</div></div></div></div></blockquote><div><br></div><div>In particular, this would have to  fall *down* to overdefined, not go back *up* to undef.</div><div><br></div></div></div></div>