[test-suite] r176903 - Perform the atomic operations on a global, rather then a local stack variable.
Chad Rosier
mcrosier at apple.com
Tue Mar 12 17:18:12 PDT 2013
On Mar 12, 2013, at 3:58 PM, Jeffrey Yasskin <jyasskin at googlers.com> wrote:
> Doesn't this indicate a bug in the atomic support rather than the
> test?
I agree.
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.
> User code shouldn't need to worry about infinite loops caused by
> compare_and_swap.
I agree.
> Either the codegen should notice that 'x' isn't
> shared and so compile away the atomics entirely,
I don't agree, yikes.
> or it should ensure
> that even the fast codegen can't interfere with the LL/SC enough to
> form an infinite loop.
This sounds like a reasonable approach.
See: http://llvm.org/bugs/show_bug.cgi?id=15502
Chad
>
> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130312/da200b33/attachment.html>
More information about the llvm-commits
mailing list