Dave Korn wrote:
> Andrew Haley wrote:
>> Volatile stores only block other
>> volatile stores: they don't block *all* stores. If you really want a
>> complete
>> memory barrier, which in a mutex you surely do, then you're going to have to
>> clobber memory.
>
> Ah. That suggests that HEAD is in fact _missing_ an optimisation that 4.3
> gets right. Maybe I should file a PR after all.
It also suggests that the register motion is fairly gratuitous, I think.
movl %eax, -12(%ebp) # tmp79, ret
movl -12(%ebp), %eax # ret, D.2120
Given that ret is a local variable that goes immediately out of scope, I
can't see any reason to update the stack slot. I can prevent this happening
by declaring the temporary as 'register __typeof (*t) ret __asm ("%eax");' but
doesn't this mean we're missing a trick here between some combination of
regalloc, copyprop and dead-store elimination?
cheers,
DaveK