> > I agree with the idea (I think it's a necessary change, or put
> > differently, an improvement, even though I may not be convinced that it
> > is a *sufficient* improvement; but let's not rehash all that here
> > again); however, I think the implementation is not the greatest.
> >
> > Volatile-qualifying the local variables does not seem useful for
> > anything. It's fine -- actually: it's beneficial -- if the compiler
> > optimizes accesses to those locals -- being on the stack -- as heavily
> > as it can. In other words, those parts of the patch look like a small
> > performance regression.

I did experiment using MSVC compiler with below code:
  int main () {
    int x;
    x = 3;
    return 0;
  }

If building the above code in optimized mode, the disassembly does not contain
any reference to local variable x.

But if I changed "int x" to "volatile int x", the compiler does not optimize 
out the
assignment of x.

So, it means the "volatile"  matters even when it applies local variables.


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#115795): https://edk2.groups.io/g/devel/message/115795
Mute This Topic: https://groups.io/mt/104483610/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to