<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 12, 2013, at 3:58 PM, Jeffrey Yasskin <<a href="mailto:jyasskin@googlers.com">jyasskin@googlers.com</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;">Doesn't this indicate a bug in the atomic support rather than the<br>test? </div></blockquote><div><br></div><div>I agree.  </div><div><br></div><div>However, IMHO it seems more reasonable to synchronize on a global variable, rather than a stack variable, however.  I'm not trying to paper over the issue here, but I would like to get our bots green.</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;">User code shouldn't need to worry about infinite loops caused by<br>compare_and_swap. </div></blockquote><div><br></div><div>I agree.</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;">Either the codegen should notice that 'x' isn't<br>shared and so compile away the atomics entirely, </div></blockquote><div><br></div><div>I don't agree, yikes.</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;">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></div></blockquote><div><br></div><div>This sounds like a reasonable approach.</div><div><br></div><div>See: <a href="http://llvm.org/bugs/show_bug.cgi?id=15502">http://llvm.org/bugs/show_bug.cgi?id=15502</a></div><div><br></div><div> Chad</div><div><br></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>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: <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: http://llvm.org/viewvc/llvm-project/test-suite/trunk/SingleSource/UnitTests/AtomicOps.c?rev=176903&r1=176902&r2=176903&view=diff<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>llvm-commits@cs.uiuc.edu<br>http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</blockquote></div></blockquote></div><br></body></html>