Re: [lttng-dev] [PATCH 02/11] urcu/uatomic: Use atomic builtins if configured

Olivier Dion via lttng-dev <[email protected]>
Newsgroups org.lttng.lists.lttng-dev
Organization EfficiOS
Message-ID <87v8ffl0ku.fsf@laura>
On Thu, 22 Jun 2023, Mathieu Desnoyers <[email protected]> wrote:
> On 6/22/23 15:53, Olivier Dion wrote:
>> On Thu, 22 Jun 2023, "Paul E. McKenney" <[email protected]> wrote:
>> 
>>> I suggest C11 volatile atomic load/store.  Load/store fusing is permitted
>>> for non-volatile atomic loads and stores, and such fusing can ruin your
>>> code's entire day.  ;-)
>> 
>> Good catch.  Seems like not a problem on GCC (yet), but Clang is extremely
>> aggressive and seems to do store fusing on some corner cases [0].
>
> I don't think this is an example of store fusing, but rather just that 
> the compiler can eliminate stores to static variables which are 
> otherwise unused, making the entire variable useless.

Indeed, that is not store fusing.  It is however interesting to see that
the dead store elimination is avoid when casting one of the &x with a
volatile qualifier.  TIL dead store can apply to atomics.

-- 
Olivier Dion
EfficiOS Inc.
https://www.efficios.com
_______________________________________________
lttng-dev mailing list
[email protected]
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.