This is an archive of the discontinued LLVM Phabricator instance.

[PM/AA] Remove the addEscapingUse update API that won't be easy to directly model in the new PM.
ClosedPublic

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

Details

Summary

This also was an incredibly brittle and expensive update API that was
never fully utilized by all the passes that claimed to preserve AA, nor
could it reasonably have been extended to all of them. Any number of
places add uses of values. If we ever wanted to reliably instrument
this, we would want a callback hook much like we have with ValueHandles,
but doing this for every use addition seems *extremely* expensive in
terms of compile time.

The only user of this update mechanism is GlobalsModRef. The idea of
using this to keep it up to date doesn't really work anyways as its
analysis requires a symmetric analysis of two different memory
locations. It would be very hard to make updates be sufficiently
rigorous to *guarantee* symmetric analysis in this way, and it pretty
certainly isn't true today.

However, folks have been using GMR with this update for a long time and
seem to not be hitting the issues. The reported issue that the update
hook fixes isn't even a problem any more as other changes to
GetUnderlyingObject worked around it, and that issue stemmed from *many*
years ago. As a consequence, a prior patch provided a flag to control
the unsafe behavior of GMR, and this patch removes the update mechanism
that has questionable compile-time tradeoffs and is causing problems
with moving to the new pass manager. Note the lack of test updates --
not one test in tree actually requires this update, even for a contrived
case.

All of this was extensively discussed on the dev list, this patch will
just enact what that discussion decides on. I'm sending it for review in
part to show what I'm planning, and in part to show the *amazing* amount
of work this avoids. Every call to the AA here is something like three
to six indirect function calls, which in the non-LTO pipeline never do
any work! =[

Depends on D11213.

Diff Detail

Repository
rL LLVM

Event Timeline

chandlerc updated this revision to Diff 29759.Jul 15 2015, 2:40 AM
chandlerc retitled this revision from to [PM/AA] Remove the addEscapingUse update API that won't be easy to directly model in the new PM..
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:12 AM
pete accepted this revision.Jul 15 2015, 10:51 AM
pete edited edge metadata.

Makes sense to remove this and get a new API in future. I think the discussion on llvmdev is extensive enough that not much more to say here than LGTM.

This revision is now accepted and ready to land.Jul 15 2015, 10:51 AM
Gerolf edited edge metadata.Jul 15 2015, 2:21 PM

I don't know this code well enough for a quality review. Certainly agree with the notion that this is a very brittle interface that is hard to maintain. And I trust your judgement that the original intent it was invented for is now obsolete. LGTM with these constraints. Also, as a bit orthogonal issue, but since you argue with ease of migration to the new pass manager (NPM): do you have a list of (potentially) performance relevant passes that could run into integration issues down the road? I suspect more(similar) performance-stability trade-offs on the road to NPM. Thanks!

Thanks Pete and Gerolf for the review. Submitting shortly.

I don't know this code well enough for a quality review. Certainly agree with the notion that this is a very brittle interface that is hard to maintain. And I trust your judgement that the original intent it was invented for is now obsolete. LGTM with these constraints. Also, as a bit orthogonal issue, but since you argue with ease of migration to the new pass manager (NPM): do you have a list of (potentially) performance relevant passes that could run into integration issues down the road? I suspect more(similar) performance-stability trade-offs on the road to NPM. Thanks!

I think I'm running out of things that will actually be substantially different between the two. AA was very near the bottom of the pile, and most of the others I've been able to fix without regressions.

The only other big one is one I already know is coming (but that will be super hard). The call graph used to drive the inliner will be different between the two pass managers. Specifically, the NPM will end up with a more precise call graph (LazyCallGraph, its already in the tree) and this may cause some significant differences with how functions are visited in the CGSCC walk. Sadly, fixing these to be the same is also *hard*. But I'm hopeful that while the difference is theoretically significant it won't in practice cause substantial performance differences.

This revision was automatically updated to reflect the committed changes.