<div dir="ltr">I think that's this bug here:<div><a href="http://llvm.org/bugs/show_bug.cgi?id=17306">http://llvm.org/bugs/show_bug.cgi?id=17306</a><br></div><div><br></div><div>Probably it's a bug in Clang's builtin IR generation.</div>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Nov 19, 2013 at 3:11 AM, Beren Minor <span dir="ltr"><<a href="mailto:beren.minor@gmail.com" target="_blank">beren.minor@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div><div><div>Hello,<br><br></div>I found some strange codegen output when playing with Clang's implementation of GCC atomic builtins and would like to know if this is some expected behavior or known issue.<br>


<br>The test case is very simple, and the disassembly can be seen here:<br><a href="http://bit.ly/18LED7t" target="_blank">http://bit.ly/18LED7t</a><br><br></div>It looks to me that these instructions after the load are unnecessary, and GCC does not generate them:<br>


    movl    %eax, -4(%rsp)<br>    movl    -4(%rsp), %eax<br><br></div>After investigating, it appears that this is caused by the volatile qualifier of the pointer parameter. Without it, the generated code is the same as GCC.<br>


<br></div>It looks like the volatile qualifier is propagated to some temporary variable that Clang uses in the LLVM IR, and after storing the atomic load result in this temporary, it has to reload it again before returning it. Showing the IR with -emit-llvm exhibits clearly this issue.<br>


<br></div>It seems to me that is is unnecessary to make this temporary volatile, isn't it?<br clear="all"><div><div><div><div><div><div><div><div><div><div>--<br>Beren Minor</div>
</div></div></div></div></div></div></div></div></div></div>
<br>_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
<br></blockquote></div><br></div>