[PATCH] D15352: [EarlyCSE] DSE of atomic unordered stores

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 8 15:04:56 PST 2015


reames added a comment.

In http://reviews.llvm.org/D15352#305348, @dberlin wrote:

> I admit to being curious why you think volatile applies to a memory
>  location , mainly because the last time it was discussed at length, i
>  remember the consensus being that volatile is about the access, not the
>  location ;-)


So, I will freely admit I haven't given this much thought.  I'm trying to not change the volatile implementation at all with these changes.  Having said that, let me explain...

In C++, I believe volatile applies to a lvalue (i.e. location).  As such, all accesses to a particular location must be either volatile or non volatile.  I know that you can use a const_cast to change the volatile qualifier on an access, but I thought it was still undefined behavior to access an location with the "wrong" qualifiers.

I'm actively trying *not* to exploit this here.  If I changed behaviour for volatile loads or stores, that's unintentional and should be discussed.


http://reviews.llvm.org/D15352





More information about the llvm-commits mailing list