This is an archive of the discontinued LLVM Phabricator instance.

[CodeGen] Add a 'NoAAResultsWrapperPass', and use it in SDAG/2Addr.
AbandonedPublic

Authored by ab on Apr 3 2017, 7:26 PM.

Details

Reviewers
chandlerc
davide
Summary

Before r247167, the pass manager builder controlled which AA
implementations were used, exporting them all in the AliasAnalysis
analysis group.

Now, AAResultsWrapperPass always uses BasicAA, but still uses other
AA implementations if made available in the pass pipeline.

IIUC, one of the many quirks of the legacy pass manager is that we
never actually recomputed BasicAA's dependencies, even though it
requires DT. I'm not sure how that never caused a problem in practice.

But regardless, both SDAG and TwoAddress are required at O0, and really
don't need to be doing fancy optimizations based on useful AA results.

Add a 'NoAAResultsWrapperPass', which just wraps an empty AAResults.
This lets us always provide conservative answers.

Ideally, the decision to use this instead of AAResultsWrapperPass
should live at a higher level, in TargetPassConfig. However, these
passes are already opt-level-aware, and untangling the legacy pass
manager to support adding arbitrary AA passes if the AAResultsWrapper
was required is a huge undertaking (and would basically undo a few
of Chandler's cleanups).

I'm really not sure this is the right approach. WDYT?

Diff Detail

Event Timeline

ab created this revision.Apr 3 2017, 7:26 PM
chandlerc edited edge metadata.Apr 11 2017, 9:12 PM

After looking at the uses of AA in both passes here, I think I like the alternative idea of making AA optional directly in the passes. Then, for the old PM, we can use something like getAnalysisIfAvailable and just not mark the analysis as required when not optimizing codegen. What do you think? Would it be helpful if I hack up a patch?

ab added a comment.May 2 2017, 3:47 PM

After looking at the uses of AA in both passes here, I think I like the alternative idea of making AA optional directly in the passes. Then, for the old PM, we can use something like getAnalysisIfAvailable and just not mark the analysis as required when not optimizing codegen. What do you think? Would it be helpful if I hack up a patch?

Yeah, that was my original attempt: I sent D32766.

I very slightly prefer hiding the fact that the pass is optional, but both approaches seem reasonable. Thanks for the help!

ab abandoned this revision.May 9 2017, 5:56 PM

D32766 replaced this; closing.