This is an archive of the discontinued LLVM Phabricator instance.

[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.
ClosedPublic

Authored by chandlerc on Jul 15 2015, 2:29 AM.

Details

Summary

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.

Diff Detail

Repository
rL LLVM

Event Timeline

chandlerc updated this revision to Diff 29758.Jul 15 2015, 2:29 AM
chandlerc retitled this revision from to [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..
chandlerc updated this object.
chandlerc added reviewers: hfinkel, Gerolf, pete.
chandlerc added a subscriber: llvm-commits.
eastig added a subscriber: eastig.Jul 15 2015, 7:13 AM
pete accepted this revision.Jul 15 2015, 10:53 AM
pete edited edge metadata.

LGTM with or without the nitpick. Thanks!

lib/Analysis/IPA/GlobalsModRef.cpp
55 ↗(On Diff #29758)

Nitpicking, but please make this a hidden option so that people are less likely to use it.

This revision is now accepted and ready to land.Jul 15 2015, 10:53 AM
Gerolf added inline comments.Jul 15 2015, 1:51 PM
lib/Analysis/IPA/GlobalsModRef.cpp
51 ↗(On Diff #29758)

is -> in

56 ↗(On Diff #29758)

My preference for default is 'true'. Innocent until proven guilty - with test case counting as a proof. If performance data is in the noise I will switch my preference.

chandlerc marked 2 inline comments as done.Jul 16 2015, 11:48 PM

Thanks Pete and Gerolf!

Based on Pete's review and some benchmark results Michael Z shared that show very limited impact of GlobalsModRef on performance, I'm submitting this as is. If folks *do* end up seeing regressions, by all means follow up here or on the commit thread and we can try other defaults, etc.

lib/Analysis/IPA/GlobalsModRef.cpp
56 ↗(On Diff #29758)

Michael Z got spec2k6 (and some other benchmarks) and some other numbers with GlobalsModRef completely disabled and the changes were in the noise, so I'm going with the default of false based on this comment.

However, if you or anyone else gets performance data that is *not* in the noise, just shout, and I'm happy to flip this the other way. =]

This revision was automatically updated to reflect the committed changes.