<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">Daniel,</div><div class="">           Thanks for taking the time to respond.</div><div class=""><br class=""></div><div class="">Regarding GVN and newGVN, I recently finished a search through the</div><div class="">llvm-dev archives for “nsw” in the subject line, and GVN was discussed in</div><div class="">some of those threads [1].</div><div class=""><br class=""></div><div class="">In particular it was claimed that there was a right choice for GVN to make given</div><div class="">two ADD instructions, one with the “nsw” attribute and one without, the one</div><div class="">without ‘nsw’ must be the representative.</div><div class=""><br class=""></div><div class="">This was described as a correctness issue, not an optimality issue. IE if you</div><div class="">are going to CSE those two ADDs, it is safe to loose information (drop the ‘nsw’)</div><div class="">but it is unsafe to put ‘nsw’ on to an operation that didn’t already have it</div><div class="">because that is like inserting an “llvm.assume" where there was none.</div><div class=""><br class=""></div><div class="">So I  am extrapolating from ’nsw’ instruction attribute, to ‘poison’ value attribute,</div><div class="">And wondering if (expecting that) you think the same logic applies.</div><div class=""><br class=""></div><div class="">I make no claim as to optimality, which seems to be what you are getting at.</div><div class=""><br class=""></div><div class="">Are you saying the post I am citing is incorrect ?</div><div class="">Or that I misunderstood it ?</div><div class="">Or could it be that you misread my email ?</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">Yes I am hoping *Nuno* can come up with a better example.  There is a claim</div><div class="">that “branch on poison is undefined behavior” is the right definition,  which is</div><div class="">not justified in the Paper [2], which John is waffling on,  which no one seems to</div><div class="">be able to justify, and which gives the appearance at least of flying in the face </div><div class="">of common sense.</div><div class=""><br class=""></div><div class="">This is the IR definition we’re talking about here, the literal heart and soul of</div><div class="">the compiler, everyone should be at least a little bit concerned.</div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">Peter Lawrence.</div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">[1.   I’m having difficulty locating the post, here’s one that is similar</div><div class=""><br class=""></div><div class=""><span class="Apple-tab-span" style="white-space:pre">   </span>Tue Jul 22, 2014 “On semantics of add instruction - nsw, nuw”</div><div class=""><br class=""></div><div class="">   It also occurs to me that the more detailed post I am remembering but</div><div class="">   can’t find might have been about SCEV rather than GVN ]</div><div class=""><div class=""><br class=""></div><div class=""><br class=""></div><div class="">[2.  “Taming undefined behavior in LLVM” ]</div></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><br class=""><div><blockquote type="cite" class=""><div class="">On Jun 14, 2017, at 2:12 PM, Daniel Berlin <<a href="mailto:dberlin@dberlin.org" class="">dberlin@dberlin.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><br class=""><div class="gmail_extra"><br class=""><div class="gmail_quote">On Wed, Jun 14, 2017 at 1:26 PM, Peter Lawrence via llvm-dev <span dir="ltr" class=""><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank" class="">llvm-dev@lists.llvm.org</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word" class=""><div dir="auto" style="word-wrap:break-word" class=""><div class=""><br class=""></div><div class="">1. ————— </div><div class="">Dan,</div><div class="">       The reasoning given below for how GVN operates seems odd to me,</div><div class=""><br class=""></div><div class="">Poison is an attribute of a value,  just like nsw is an attribute of an operation,</div><div class=""><br class=""></div><div class="">So when GVN sees a pair of equal values, one of which has an extra attribute,</div><div class="">The proper choice for representative value is the one without the attribute,</div></div></div></blockquote><div class=""><br class=""></div><div class="">There are many many choices of what make *good* representative values in NewGVN.</div><div class="">I would deny any assertion that there is a proper choice, and that if there is one, it must be what you suggest :)</div><div class="">You actually can prove that there is no optimal such choice.  Different choices will lead you to discover different congruences in any practical algorithms, even complete ones (as the issues here are orthogonal to herbrand equivalence., and instead related to inference of facts from control flow and other things, as well as what the results from symbolic evaluation and simplification)</div><div class="">There are examples in the paper cited by newgvn of situations where different choices of values for predicate and phi inference will enable you to discover different congruences.<br class=""></div><div class=""><br class=""></div><div class="">More importantly, given the other purpose of the representatives is to be used during simplification and symbolic evaluation, something we know we *cannot* possibly be optimal at, i do not believe you can assert that there is such an easily knowable best representative.</div><div class=""><br class=""></div><div class="">There is also no representation we could pick that would avoid all issues for others</div><div class=""><br class=""></div><div class=""><br class=""></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word" class=""><div dir="auto" style="word-wrap:break-word" class=""><div class=""><br class=""></div><div class="">Thoughts ?</div><div class="">Comments ?</div><div class="">Questions ?</div></div></div></blockquote><div class=""><br class=""></div><div class="">The middle one.</div><div class=""><br class=""></div><div class="">I'm going to be frank and honest:</div><div class="">I don't feel like i have a good understanding of what your goal here is, or what you see your role as.</div><div class="">I can tell you, again, completely personally, that i find your approach off-putting at times.</div><div class="">To give a concrete example, here, what i see (again, from *my* perspective), is you are asserting things to me and asking me to confirm them or disprove them. I generally have not found this to be a good collaborative approach to increasing understanding.  You then say"If Dan agrees with the above then can we come up with a better example".  In practice, so far, that has meant "can *Nuno* come up with a better example" (IE the we seems to be turning into work for others).</div><div class=""><br class=""></div><div class="">I do not say this as a true complaint so much as a explanation of why i don't feel like i understand your perspective on things, and i think it would be  helpful for me to be able to.</div><div class="">I also certainly do not claim that there are not multiple ways to approach problem solving, communities, etc, or that what I or anyone else does is best.<br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div></div></div></div>
</div></blockquote></div><br class=""></body></html>