[PM/AA] Disable the core unsafe aspect of GlobalsModRef in the face of
authorChandler Carruth <chandlerc@gmail.com>
Fri, 17 Jul 2015 06:58:24 +0000 (06:58 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Fri, 17 Jul 2015 06:58:24 +0000 (06:58 +0000)
commitf55803f761340107d3be8dc3a582f87fe4e2ea98
tree6eb53ec4d47ac12bd14b8dc0d7902191023c98c5
parent7ef4bf5e22a526490262320ede77a2e0336bc66a
[PM/AA] Disable the core unsafe aspect of GlobalsModRef in the face of
basic changes to the IR such as folding pointers through PHIs, Selects,
integer casts, store/load pairs, or outlining.

This leaves the feature available behind a flag. This flag's default
could be flipped if necessary, but the real-world performance impact of
this particular feature of GMR may not be sufficiently significant for
many folks to want to run the risk.

Currently, the risk here is somewhat mitigated by half-hearted attempts
to update GlobalsModRef when the rest of the optimizer changes
something. However, I am currently trying to remove that update
mechanism as it makes migrating the AA infrastructure to a form that can
be readily shared between new and old pass managers very challenging.
Without this update mechanism, it is possible that this still unlikely
failure mode will start to trip people, and so I wanted to try to
proactively avoid that.

There is a lengthy discussion on the mailing list about why the core
approach here is flawed, and likely would need to look totally different
to be both reasonably effective and resilient to basic IR changes
occuring. This patch is essentially the first of two which will enact
the result of that discussion. The next patch will remove the current
update mechanism.

Thanks to lots of folks that helped look at this from different angles.
Especial thanks to Michael Zolotukhin for doing some very prelimanary
benchmarking of LTO without GlobalsModRef to get a rough idea of the
impact we could be facing here. So far, it looks very small, but there
are some concerns lingering from other benchmarking. The default here
may get flipped if performance results end up pointing at this as a more
significant issue.

Also thanks to Pete and Gerolf for reviewing!

Differential Revision: http://reviews.llvm.org/D11213

llvm-svn: 242512
llvm/lib/Analysis/IPA/GlobalsModRef.cpp
llvm/test/Analysis/GlobalsModRef/aliastest.ll
llvm/test/Analysis/GlobalsModRef/indirect-global.ll