The -globalopt pass is made to require -invariant-info-marker, similarly to -gvn. (Note: Both -gvn and -globalopt require basic AA.)
The test case is also expanded to illustrate the subtle nuances and expected similarities between local and global variables.
I think the usual way to write this is like: