[PATCH][RFC] Remove volatile from data members in libstdc++
Andrew Pinski
pinskia@physics.uc.edu
Wed Jul 19 22:25:00 GMT 2006
On Jul 20, 2006, at 2:01 AM, Boehm, Hans wrote:
> Assume rc is non-volatile, and we have
>
> switch(...) {
> case ...:
> ...; rc = 1; break;
> case ...:
> ...; rc = 1; break;
> case foo:
> ...; rc = 2; break;
> case ...:
> ...; rc = 1; break;
> case ...:
> ...; rc = 1; break;
> default:
> ...; rc = 1; break;
> }
>
> Where the ellipses are known to not include any synchronizatiobn
> calls,
> and do not touch rc.
>
> This can safely (even under the proposed C++ memory model) be
> transformed to:
Actually I doubt that will be done that way, it will most likely be
push the store below
the switch as usually the ... might read from it and it is actually
slower the way you
recommended the transformation to happen as now you have two stores
in one case while
the previous case you have one. You always want to reduce the number
of stores, not
increase them.
-- Pinski
More information about the Gcc-patches
mailing list