[cpp-threads] Review comments on N2176 WRT dependency ordering

Peter Dimov pdimov at mmltd.net
Wed Apr 18 23:29:36 BST 2007


Paul E. McKenney wrote:
> On Wed, Apr 18, 2007 at 02:08:57PM +0300, Peter Dimov wrote:

>> I think that if we have compiler fences at all, we'll have this
>> problem of optimization validity in their presence anyway.
>
> The acquire and release operations that imply actual machine
> instructions must also impose constraints on code-motion
> optimization, so this is a more general requirement, right?

Very true. For example the compiler should not transform:

r1 = *p;
r2 = load_acquire( &q );
r3 = *r2;

into:

r1 = *p;
r2 = load_acquire( &q );
r3 = r2 == p? r1: *r2;

which seems basically the same problem. Local dependency propagation would 
still be needed for things such as r1 - r1, though. 




More information about the cpp-threads mailing list