We have a problem.
There is a common C/C++ idiom, (*((volatile int *)(0))) = 0;,
which some users write expecting that it will trap.
Currently clang naively lowers it into a volatile store.
But in LLVM, a volatile store is non-trapping:
https://reviews.llvm.org/D53184 ([LangRef] Clarify semantics of volatile operations.),
and that does not seem to be going to change.
So LLVM optimization passes are allowed to erase such stores (because storing to null is undefined),
even though they currently don't do that, because it will break the C world.
The latter has to change. D105338 tried to, but it caused the sky to fall :)
Here, we teach clang to emit the pattern that the user should have written in the first place,
so that the workarounds can be dropped from LLVM side of things.
This fires when we have a volatile store to a null pointer literal,
and said null pointer is not a valid pointer.