This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH][RFC] Remove volatile from data members in libstdc++



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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]