<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 May 18, 2015, at 12:31 AM, Hal Finkel <<a href="mailto:hfinkel@anl.gov" class="">hfinkel@anl.gov</a>> wrote:</div><br class="Apple-interchange-newline"><div class="">Hi Escha,<br class=""><br class="">In the future, please post patches like this using phabricator. Although trivial, it is much easier to see the full context of the patch using the web interface (because, when uploading a patch, you upload with full context and let the web interface reduce it dynamically). Please see: <a href="http://llvm.org/docs/Phabricator.html#requesting-a-review-via-the-web-interface" class="">http://llvm.org/docs/Phabricator.html#requesting-a-review-via-the-web-interface</a><br class=""></div></blockquote><div><br class=""></div><div>Okay; I’ll use Phab from now on.</div><br class=""><blockquote type="cite" class=""><div class=""><br class=""><blockquote type="cite" class="">+ (!LegalOperations || TLI.isOperationLegal(ISD::AND, VT)) &&<br class=""></blockquote><br class="">I'd prefer that we use TLI.isOperationLegalOrCustom here; otherwise, LGTM.</div></blockquote></div><div><br class=""></div><div>For me, this came up when I was trying to implement the following optimization: when legalizing i64 AND with a custom lowering, if the high half of the output is known to be zero (for whatever reason), convert it from (AND A, B) into (ZERO_EXTEND (AND (TRUNC A, TRUNC B))). This caused an infinite DAG loop, because the DAG combine here tried to make it back into an AND even though i64 AND was not legal.</div><div><br class=""></div><div>If I use “isOperationLegalOrCustom” here, the infinite loop comes back, because it believes i64 AND is okay, so it proceeds to re-create the original pattern and call back into the same legalization code.</div><div><br class=""></div><div>Is what I’m doing inherently wrong, or is LegalOrCustom not the right thing here?</div><div><br class=""></div><div>—escha</div></body></html>