<html><head><meta http-equiv="Content-Type" content="text/html charset=iso-8859-1"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><br><div><div>On Mar 13, 2013, at 12:33 PM, Nick Lewycky <<a href="mailto:nicholas@mxc.ca">nicholas@mxc.ca</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">Jeffrey Yasskin wrote:<br><blockquote type="cite">Doesn't this indicate a bug in the atomic support rather than the<br>test? User code shouldn't need to worry about infinite loops caused by<br>compare_and_swap. Either the codegen should notice that 'x' isn't<br>shared and so compile away the atomics entirely, or it should ensure<br>that even the fast codegen can't interfere with the LL/SC enough to<br>form an infinite loop.<br></blockquote><br>Ping! Chad, I think Jeff is exactly right. Please revert this change, or convince me it's right.<br></div></blockquote><div><br></div><div>Hi Nick,</div><div>I replied here:</div><div><a href="http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20130311/168108.html">http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20130311/168108.html</a></div><div><br></div><div>The change to the test-case is perfectly valid.  In fact, I think it's more realistic.  </div><div><br></div><div>However, we shouldn't ignore is issue, so I filed a PR here:</div><div><div><a href="http://llvm.org/bugs/show_bug.cgi?id=15502" style="white-space: pre-wrap;">http://llvm.org/bugs/show_bug.cgi?id=15502</a></div><div><br></div></div><div> Chad</div><br><blockquote type="cite"><div style="letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"><br>Nick<br><br><blockquote type="cite">On Tue, Mar 12, 2013 at 3:07 PM, Chad Rosier<<a href="mailto:mcrosier@apple.com">mcrosier@apple.com</a>>  wrote:<br><blockquote type="cite">Author: mcrosier<br>Date: Tue Mar 12 17:07:00 2013<br>New Revision: 176903<br><br>URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project?rev=176903&view=rev">http://llvm.org/viewvc/llvm-project?rev=176903&view=rev</a><br>Log:<br>Perform the atomic operations on a global, rather then a local stack variable.<br>This was causing failures on one of our internal -O0 testers.<br><br>The issue appears to be that spills/refills to/from the stack are clearing the<br>monitor and causing the atomic operations to fail, which results in the benchmark<br>going into an infinite loop.  This seems to only happen at -O0 because the<br>fast-regalloc is generating a reload in-between the excusive load and exclusive<br>store to a stack slot adjacent to the local variable x.<br><a href="rdar://13363219">rdar://13363219</a><br><br>Modified:<br>    test-suite/trunk/SingleSource/UnitTests/AtomicOps.c<br><br>Modified: test-suite/trunk/SingleSource/UnitTests/AtomicOps.c<br>URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/test-suite/trunk/SingleSource/UnitTests/AtomicOps.c?rev=176903&r1=176902&r2=176903&view=diff">http://llvm.org/viewvc/llvm-project/test-suite/trunk/SingleSource/UnitTests/AtomicOps.c?rev=176903&r1=176902&r2=176903&view=diff</a><br>==============================================================================<br>--- test-suite/trunk/SingleSource/UnitTests/AtomicOps.c (original)<br>+++ test-suite/trunk/SingleSource/UnitTests/AtomicOps.c Tue Mar 12 17:07:00 2013<br>@@ -5,8 +5,8 @@ int foo(volatile *mem, int val, int c) {<br>   return oldval + c;<br> }<br><br>+volatile int x = 0;<br> int main() {<br>-  volatile int x = 0;<br>   int y = foo(&x, 1, 2);<br>   printf("%d, %d\n", y, x);<br>   y = __sync_val_compare_and_swap(&x, 1, 2);<br><br><br>_______________________________________________<br>llvm-commits mailing list<br><a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br><a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br></blockquote>_______________________________________________<br>llvm-commits mailing list<br><a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br><a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a></blockquote></div></blockquote></div><br></body></html>