These are not even the only fun bugs and issues that lurk in how various alias/invariant/etc related things are designed in llvm, and trying to figure out the regions they cover.
For anyone ever designing a compiler, do yourself a huge favor: do not try to scope aliasing/etc info using metadata. Make it an explicit part of the ir somehow so that the control and dataflow is explicit to the compiler.
(GCC went thru the same fun before LLVM did).
It seems like a good idea at first, but it is almost impossible to keep it conservatively correct during transforms (unless you drop it when anything at all changes, which also turns out badly)
For anyone ever designing a compiler, do yourself a huge favor: do not try to scope aliasing/etc info using metadata. Make it an explicit part of the ir somehow so that the control and dataflow is explicit to the compiler. (GCC went thru the same fun before LLVM did).
It seems like a good idea at first, but it is almost impossible to keep it conservatively correct during transforms (unless you drop it when anything at all changes, which also turns out badly)