[LLVMdev] [llvm-commits] [llvm] r79731 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp

Duncan Sands baldrick at free.fr
Mon Aug 24 10:40:25 PDT 2009


Hi Owen,

>>>     VTs[VT.getSimpleVT().SimpleTy] = VT;
>>> -    return &VTs[VT.getSimpleVT().SimpleTy];
>>> +    sys::MemoryFence();
>>
>> I don't think this fence actually does anything useful unless
>> users of the pointer do a fence before reading the contents
>> of the pointer.  That said, I think alpha is the only platform
>> where you have to worry about this kind of pointer vs pointee
>> race.
> 
> I'm fairly sure that the only things that dereference into the array
> are callers of this method, who dereference it through the returned
> pointer.  The purpose of the fence is to guarantee that the valid has
> been written before the pointer is returned to the caller.

as far as I know, using a memory barrier on CPU A has absolutely zero
effect on other CPUs unless they also do a memory barrier.  The fence
on CPU A causes it to publish information about its memory writes, and
pay attention to information published by other CPUs.  It doesn't force
other CPUs to pay attention to its info.  That's why I think this fence
is bogus: without a corresponding fence on readers of the value, it
doesn't do anything.

Ciao,

Duncan.



More information about the llvm-dev mailing list