This is an archive of the discontinued LLVM Phabricator instance.

IR printing for single function with the new pass manager.
ClosedPublic

Authored by hoyFB on Feb 18 2020, 11:23 PM.

Details

Summary

The IR printing always prints out all functions in a module with the new pass manager, even with -filter-print-funcs specified. This is being fixed in this change. However, there are two exceptions, i.e, with user-specified wildcast switch -filter-print-funcs=* or -print-module-scope, under which IR of all functions should be printed.

Test Plan:
make check-clang
make check-llvm

Diff Detail

Event Timeline

hoyFB created this revision.Feb 18 2020, 11:23 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptFeb 18 2020, 11:23 PM
hoyFB added a subscriber: wenlei.

Thanks for fixing this. Could you use .ll IR file as test case and place it alongside with test/Other/module-pass-printer.ll or just reuse that one? We can also use opt to invoke new pass manager, so it doesn't need to be a clang test.

hoyFB added a comment.Feb 19 2020, 8:48 AM

Thanks for fixing this. Could you use .ll IR file as test case and place it alongside with test/Other/module-pass-printer.ll or just reuse that one? We can also use opt to invoke new pass manager, so it doesn't need to be a clang test.

Sounds good. I was trying to figure out how to invoke the new pass manager with OPT. Is there a command line switch to do that?

Sounds good. I was trying to figure out how to invoke the new pass manager with OPT. Is there a command line switch to do that?

If you just do opt -passes=<pass_names>, it will invoke new pass manager for opt. See https://reviews.llvm.org/D66560 for example - that was for legacy PM, the equivalent for new PM would be something like opt < %s 2>&1 -passes=forceattrs ...

hoyFB updated this revision to Diff 245474.Feb 19 2020, 11:03 AM

Updating D74814: IR printing for single function with the new pass manager.

wenlei accepted this revision.Feb 19 2020, 11:16 AM

Thanks for the making the changes, it would be nice to have some consistency (the same structure) between test cases for legacy PM and new PM, e.g. EMPTY is only tested for legacy PM, but not new; multi-function filter also only tested for legacy PM, would be nice to do them for both, and unify the check-prefix, otherwise LGTM.

This revision is now accepted and ready to land.Feb 19 2020, 11:16 AM
hoyFB updated this revision to Diff 245484.Feb 19 2020, 11:47 AM

Updating D74814: IR printing for single function with the new pass manager.

This revision was automatically updated to reflect the committed changes.

Committed on behalf of @hoyFB per request.