This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Optimization of conditional stores (was: Re: [PATCH] Add adaptive elision to rwlocks)


> If the compiler can prove that `ptr' must be pointing to writeable location
> (for instance if there is a preceding (dominating) unconditional store), it
> can, and likely will, perform the optimization.

Except it's not an optimization, but a pessimization

Which compiler would do that? It sounds very broken to me.

> 
> I would also suggest making the intent (perform the store only when necessary)
> explicit, and make sure to disallow the compiler optimization, for example:
> 
>     if (*ptr != value)
>         *(volatile typeof(*ptr)*)ptr = value;

That's really ugly.

-Andi


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]