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

Duncan Sands baldrick at free.fr
Mon Aug 24 01:32:06 PDT 2009


Hi Owen,

> +    // All writes to this location will have the same value, so it's ok
> +    // to race on it.  We only need to ensure that at least one write has
> +    // succeeded before we return the pointer into the array.

unfortunately, race detectors like helgrind don't like this kind of
thing, and report it as a race.  Last time I asked about it I was
told that fixing it would be too hard/expensive.

>      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.

> +    return VTs + VT.getSimpleVT().SimpleTy;
>    }
>  }

Ciao,

Duncan.



More information about the llvm-commits mailing list