<div dir="ltr">I don't think the X86 cmov converter pass knows about unpredictable? Do we even preserve that metadata into Machine IR?<div><br></div><div>There's also this frontend bug with the builtin getting translated to IR <a href="https://bugs.llvm.org/show_bug.cgi?id=40031">https://bugs.llvm.org/show_bug.cgi?id=40031</a><div><div><br clear="all"><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature">~Craig</div></div><br></div></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Sep 13, 2019 at 2:18 PM Sanjay Patel via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>I'm not sure if this is the entire problem, but SimplifyCFG loses the 'unpredictable' metadata when it converts a set of cmp/br into a switch:</div><div><a href="https://godbolt.org/z/neLzN3" target="_blank">https://godbolt.org/z/neLzN3</a></div><div><br></div><div>Filed here:<br></div><div><a href="https://bugs.llvm.org/show_bug.cgi?id=43313" target="_blank">https://bugs.llvm.org/show_bug.cgi?id=43313</a></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Sep 13, 2019 at 4:02 AM David Zarzycki via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><br><div><br><blockquote type="cite"><div>On Sep 13, 2019, at 10:45 AM, Chandler Carruth <<a href="mailto:chandlerc@gmail.com" target="_blank">chandlerc@gmail.com</a>> wrote:</div><br class="gmail-m_-1985626468060182016gmail-m_8230130797611526511gmail-m_-2315415634143319037Apple-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;text-decoration:none"><div dir="ltr">On Fri, Sep 13, 2019 at 1:33 AM David Zarzycki via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div>Hi Chandler,<div><br></div><div>The data-invariant feature sounds great but what about the general case? When performance tuning code, people sometimes need the ability to reliably generate CMOV, and right now the best advice is either “use inline assembly” or “keep refactoring until CMOV is emited” (and hope that future compilers continue to generate CMOV).</div><div><br></div><div>Given that a patch already exists to reliably generate CMOV, are there any good arguments against adding the feature?</div></div></blockquote><div><br></div><div>For *performance* tuning, the builtin that Hal mentioned is IMO the correct design.</div><div><br></div><div>Is there some reason why it doesn't work?</div></div></div></div></blockquote><br></div><div>I wasn’t aware of __builtin_unpredictable() until now and I haven’t debugged why it doesn’t work, but here are a couple examples, one using the ternary operator and one using a switch statement:</div><div><br></div><div><a href="https://godbolt.org/z/S46I_q" target="_blank">https://godbolt.org/z/S46I_q</a></div><div><br></div><div>Dave</div></div>_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div>