<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=""><br class=""><div><blockquote type="cite" class=""><div class="">On Dec 4, 2016, at 3:22 PM, LYU YH via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">Hello Sean,<br class=""><br class="">I read several LLVM undef materials[1][2][3] but still have some questions of it. I can understand "add %X, undef -> undef". But why the equation "and %X, undef -> 0" is valid? In LLVM Language Reference Manual, the explanation of such equation is that it is safe to assume that all bits of the ‘undef‘ could be 0. If so, why can't we assume all bits of the 'undef' is 0 in the former equation. Therefore we can get "add %X, 0 -> %X" instead?<br class=""></div></div></blockquote><div><br class=""></div><div>For integer I believe you’re allowed to fold add %X, 0 -> %X</div><div><br class=""></div><div>AFAIK you can use any valid bit pattern for the type when replacing an undef.</div><div><br class=""></div><div>— </div><div>Mehdi</div><div><br class=""></div><div><br class=""></div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><br class="">By the way, is there any document that describe how 'undef' should be handled with other LLVM value? Is the 'undef' in LLVM the same as the UNDEF[4] (the top element in lattice) in constant propagation?<br class=""><br class="">[1] <a href="http://www.nondot.org/sabre/LLVMNotes/UndefinedValue.txt" class="">http://www.nondot.org/sabre/LLVMNotes/UndefinedValue.txt</a><br class="">[2] <a href="https://www.cs.utah.edu/~regehr/llvm-ub.pdf" class="">https://www.cs.utah.edu/~regehr/llvm-ub.pdf</a><br class="">[3] <a href="http://sunfishcode.github.io/blog/2014/07/14/undef-introduction.html" class="">http://sunfishcode.github.io/blog/2014/07/14/undef-introduction.html</a><br class="">[4] <a href="http://infolab.stanford.edu/~ullman/dragon/w06/lectures/cp.pdf" class="">http://infolab.stanford.edu/~ullman/dragon/w06/lectures/cp.pdf</a><br class=""><br class="">Thanks for your reply<br class=""></div>
_______________________________________________<br class="">LLVM Developers mailing list<br class=""><a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a><br class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev<br class=""></div></blockquote></div><br class=""></body></html>