When checking if a Value can alias a non-addr-taken global, if the Value is a LoadInst, then it cannot alias the global.
In order for the two to alias, the Value must be a pointer within the
global object. If that pointer has just been loaded from memory, it
cannot possibly alias the global as we know the global's address could
never have ended up in memory in the first place.
I've thrown all the testing I have at this, and it hasn't triggered any miscompares anywhere... but that's no evidence that there isn't a counterexample to my logic above.
Hal and Chandler - I've thought about this a *lot* and I think my logic is correct, but would you guys mind validating it? Thanks!
GlobalValue is repeated here. I would keep a single if, and merge the two comments. Your comment above is excellent.