I've mentioned elsewhere the standards, and compilers as well, disagreeing with you here.
But feel free to run against the various compilers through godbolt. [0] They won't optimise the branch away. Access to a volatile, must be preserved, in the order that they exist. No optimisation, UB or otherwise, is allowed to impede that. Because an access is a side-effect.
That they won’t is as most a courtesy to you but they are not required to do this.
Compilers not doing something is not a demonstration that they are not actually allowed to do that thing.