<div dir="ltr">On 27 June 2014 09:18, Nick Lewycky <span dir="ltr"><<a href="mailto:nicholas@mxc.ca" target="_blank">nicholas@mxc.ca</a>></span> wrote:<br><div class="gmail_extra"><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 class="">Rafael Avila de Espindola wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
Ccing nick since it seems related to the enable_if attribute.<br>
</blockquote>
<br></div>
Surely not? attribute enable_if is defined entirely in language terms.<br>
<br>
I don't see it in LangRef but I thought we already had @llvm.is.constant to implement __builtin_constant_p in the middle-end? If I'm remembering right then what we should do is try to match gcc's behaviour.<span class=""><font color="#888888"><br>
</font></span></blockquote><div><br></div><div>Currently, __builtin_constant_p() is lowered to true/false in clang. Adding this intrinsic (and using it in clang) will allow the compiler to optimise the following code:<br>
int inline __attribute__((always_inline)) fun(int x) {<br>    return __builtin_constant_p(x);<br>}<br><br>int main() {<br>    return fun(0);<br>}<br><br></div><div>This example will return 1 if compiled with gcc but it will return 0 if compiled with clang.<br>
<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span class=""><font color="#888888">
<br>
Nick</font></span><div class=""><div class="h5"><br>
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">

On Jun 25, 2014, at 11:22, Janusz Sobczak<<a href="mailto:janusz.sobczak@mobica.com" target="_blank">janusz.sobczak@mobica.<u></u>com</a>>  wrote:<br>
<br>
================<br>
Comment at: test/CodeGen/Generic/inline-<u></u>is-constant.ll:4<br>
@@ +3,3 @@<br>
+; Expected outcome: @fun is inlined and @llvm.is.constant is resolved to TRUE<br>
+; Without inlining @llvm.is.constant would resolve to FALSE.<br>
+<br>
----------------<br>
Renato Golin wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
a more robust way would be to have two run lines, one with O0, another with O3, and use FileCheck for the True/False results.<br>
</blockquote>
If using lli is frowned upon, then the resolution is to call 'llc -debug' and search for the debug strings with FileCheck<br>
<br>
<a href="http://reviews.llvm.org/D4276" target="_blank">http://reviews.llvm.org/D4276</a><br>
<br>
<br>
<br>
______________________________<u></u>_________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu" target="_blank">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/<u></u>mailman/listinfo/llvm-commits</a><br>
</blockquote>
<br>
</blockquote>
<br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br><div dir="ltr">Janusz Sobczak<br>Mobica Ltd<br><a href="http://www.mobica.com" target="_blank">www.mobica.com</a> <<a href="http://www.mobica.com" target="_blank">http://www.mobica.com</a>><br>
<br><br>*Mobica is a provider of software engineering, testing and consultancy <br>services based in the UK, Poland and the USA, with a worldwide customer <br>base. We have a proven track record in delivering innovative solutions to <br>
some of the world’s best-known companies in a range of sectors including <br>Automotive, Mobile, Semiconductor, Finance, TV, Marine and Aviation.*<br><br></div>
</div></div>