[patch] conditional store elimination

Andrew Pinski pinskia@gmail.com
Thu Sep 6 23:06:00 GMT 2007

On 9/6/07, Jakub Jelinek <jakub@redhat.com> wrote:
> Shouldn't we turn this optimization for -fopenmp though?
> If some shared variable (whether it is in a function using #pragma omp
> constructs or in some function such constructs perhaps indirectly call)
> is always read and only conditionally stored, if this optimization turns it
> into unconditional store, it creates a race condition.

Again what makes you think openmp is special?  You are going to create
race conditions with or without openmp if people are doing threading
programs.  Maybe openmp needs more light weight locks for its usage.
Seriously C/C++ does not have a threading model (yet).  Likewise for
Fortran.  Can someone please define GCC's threading model before we
get too far into this discussion.

Here is my threading model, if there are no locks around the code,
then all transformations which cause conditional stores to
unconditional stores or decrease of stores is valid.

Andrew Pinski

More information about the Gcc-patches mailing list