This is an archive of the discontinued LLVM Phabricator instance.

[opt][NewPM] Add basic-aa in legacy PM compatibility mode
ClosedPublic

Authored by aeubanks on Aug 18 2020, 1:12 PM.

Details

Summary

The legacy PM alias analysis pipeline by default includes basic-aa.
When running opt -foo-pass under the NPM and -disable-basic-aa is not
specified, use basic-aa.

This decreases the number of check-llvm failures under NPM from 913 to 752.

Diff Detail

Event Timeline

aeubanks created this revision.Aug 18 2020, 1:12 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 18 2020, 1:12 PM
aeubanks requested review of this revision.Aug 18 2020, 1:12 PM

This decreases the number of check-llvm failures under NPM from 913 to 752.

This is great!

llvm/tools/opt/NewPMDriver.cpp
351

I think it is helpful to be specific here, saying something like "AAResultsWrapperPass` by default provide basic-aa in legacy PM."

Could we combine this code with the if (!AAPipeline.empty()) code above? If the AAPipeline is empty, we could make it "basic-aa".

ltgm with ychen's comment addressed (use AAPipeline empty check and merge with the above check)

aeubanks updated this revision to Diff 286687.Aug 19 2020, 4:59 PM

Add more detail in comments

llvm/tools/opt/NewPMDriver.cpp
351

Added comment.

I don't want to change the semantics of any tests using opt -passes=foo, this is purely for compatibility with tests using opt -foo-pass.

And actually I think having to explicitly specify basic-aa makes more sense than implicitly adding it, so I like the NPM way of doing it. But that's a different discussion.

ychen added inline comments.Aug 19 2020, 5:11 PM
llvm/tools/opt/NewPMDriver.cpp
351

That makes sense. Does it mean this code is temporary? i.e once we switch to NPM, we will remove this code and mass-adding basic-aa to relevant tests? If so, then sounds good to me.

aeubanks added inline comments.Aug 19 2020, 5:18 PM
llvm/tools/opt/NewPMDriver.cpp
351

I was thinking that would happen alongside whenever we migrate tests to use '-passes='.

ychen accepted this revision.Aug 19 2020, 5:41 PM
ychen added inline comments.
llvm/tools/opt/NewPMDriver.cpp
351

Sounds good. Please add a comment about the next step related to this code.

Could you check the empty AAPipeline instead? The code right now is adding basic-aa to AAPipeline.

This revision is now accepted and ready to land.Aug 19 2020, 5:41 PM
ychen added a comment.Aug 19 2020, 5:42 PM

Please let @asbirlea acknowledge this also.

aeubanks updated this revision to Diff 286852.Aug 20 2020, 10:22 AM

Add comment

llvm/tools/opt/NewPMDriver.cpp
351

Added comment.

AAPipeline has nothing to do with the legacy PM compatibility mode (there's an assert checking that it is empty if we are in the legacy PM compat mode). The code isn't adding basic-aa to AAPipeline, it's adding it to AA.

ychen added inline comments.Aug 20 2020, 11:06 AM
llvm/tools/opt/NewPMDriver.cpp
351

Oh, now I see the implicit assert above. I was looking for an assertion related to AAPipeline. Thanks. Looks good to me.

asbirlea added inline comments.Aug 20 2020, 3:54 PM
llvm/tools/opt/NewPMDriver.cpp
351

I honestly don't like the idea of doing this now just for the tests.

We've had out-of-tree testing in the community that relied on the -disable-aa flag, and on other particular command-line behavior for fuzz testing. This patch is changing the current NPM expected behavior.

We either change the behavior in this patch and stick to it, or we update the tests at this point and never change the behavior in the first place.
I think ping-ponging with expectations just to delay test changes is not a positive experience for such users.

aeubanks added inline comments.Aug 21 2020, 12:22 PM
llvm/tools/opt/NewPMDriver.cpp
351

Keeping the behavior in this patch going forward does sound better.
My main intention was that if we ever get rid of the opt -foo-pass syntax and migrate relevant tests to use opt -passes=foo -aa-pipeline=basic-aa, we can delete this. Not that we'd go back and add -basic-aa to opt -foo-pass tests later.

Maybe the comment I added isn't clear, but that's what I meant.

asbirlea accepted this revision.Aug 21 2020, 1:30 PM

sgtm.