[test-suite] r176903 - Perform the atomic operations on a global, rather then a local stack variable.

Chad Rosier mcrosier at apple.com
Wed Mar 13 12:47:40 PDT 2013


On Mar 13, 2013, at 12:33 PM, Nick Lewycky <nicholas at mxc.ca> wrote:

> Jeffrey Yasskin wrote:
>> Doesn't this indicate a bug in the atomic support rather than the
>> test? User code shouldn't need to worry about infinite loops caused by
>> compare_and_swap. Either the codegen should notice that 'x' isn't
>> shared and so compile away the atomics entirely, or it should ensure
>> that even the fast codegen can't interfere with the LL/SC enough to
>> form an infinite loop.
> 
> Ping! Chad, I think Jeff is exactly right. Please revert this change, or convince me it's right.

Hi Nick,
I replied here:
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20130311/168108.html

The change to the test-case is perfectly valid.  In fact, I think it's more realistic.  

However, we shouldn't ignore is issue, so I filed a PR here:
http://llvm.org/bugs/show_bug.cgi?id=15502

 Chad

> 
> Nick
> 
>> On Tue, Mar 12, 2013 at 3:07 PM, Chad Rosier<mcrosier at apple.com>  wrote:
>>> Author: mcrosier
>>> Date: Tue Mar 12 17:07:00 2013
>>> New Revision: 176903
>>> 
>>> URL: http://llvm.org/viewvc/llvm-project?rev=176903&view=rev
>>> Log:
>>> Perform the atomic operations on a global, rather then a local stack variable.
>>> This was causing failures on one of our internal -O0 testers.
>>> 
>>> The issue appears to be that spills/refills to/from the stack are clearing the
>>> monitor and causing the atomic operations to fail, which results in the benchmark
>>> going into an infinite loop.  This seems to only happen at -O0 because the
>>> fast-regalloc is generating a reload in-between the excusive load and exclusive
>>> store to a stack slot adjacent to the local variable x.
>>> rdar://13363219
>>> 
>>> Modified:
>>>     test-suite/trunk/SingleSource/UnitTests/AtomicOps.c
>>> 
>>> Modified: test-suite/trunk/SingleSource/UnitTests/AtomicOps.c
>>> URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/SingleSource/UnitTests/AtomicOps.c?rev=176903&r1=176902&r2=176903&view=diff
>>> ==============================================================================
>>> --- test-suite/trunk/SingleSource/UnitTests/AtomicOps.c (original)
>>> +++ test-suite/trunk/SingleSource/UnitTests/AtomicOps.c Tue Mar 12 17:07:00 2013
>>> @@ -5,8 +5,8 @@ int foo(volatile *mem, int val, int c) {
>>>    return oldval + c;
>>>  }
>>> 
>>> +volatile int x = 0;
>>>  int main() {
>>> -  volatile int x = 0;
>>>    int y = foo(&x, 1, 2);
>>>    printf("%d, %d\n", y, x);
>>>    y = __sync_val_compare_and_swap(&x, 1, 2);
>>> 
>>> 
>>> _______________________________________________
>>> llvm-commits mailing list
>>> llvm-commits at cs.uiuc.edu
>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130313/a1ee9461/attachment.html>


More information about the llvm-commits mailing list