This is an archive of the discontinued LLVM Phabricator instance.

[NewPM][PassInstrumentation] IR printing support from clang driver
ClosedPublic

Authored by twoh on Aug 8 2019, 2:25 PM.

Details

Summary

https://reviews.llvm.org/D50923 enabled the IR printing support for the new pass manager, but only for the case when opt tool is used as a driver. This patch is to enable the IR printing when clang is used as a driver.

Event Timeline

twoh created this revision.Aug 8 2019, 2:25 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 8 2019, 2:25 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
twoh added a comment.Aug 8 2019, 2:27 PM

@fedor.sergeev @yamauchi I saw your discussions over llvm-dev mailing list regarding IR printing with the new pass manager, and though this might be the reason why IR printing is not supported under new PM with clang. I would appreciate if you can take a look.

wenlei added a subscriber: wenlei.Aug 9 2019, 7:39 AM

@fedor.sergeev @yamauchi I saw your discussions over llvm-dev mailing list regarding IR printing with the new pass manager, and though this might be the reason why IR printing is not supported under new PM with clang. I would appreciate if you can take a look.

I tested it and it works for me. Thanks!

@fedor.sergeev @yamauchi I saw your discussions over llvm-dev mailing list regarding IR printing with the new pass manager, and though this might be the reason why IR printing is not supported under new PM with clang. I would appreciate if you can take a look.

Yep, you are right, standard instrumentation needs to be passed into PassBuilder for printing and time-passes to work.
Main changes are fine, just a small note on the test below.

clang/test/Misc/printer.c
1

Can this test avoid using -O2 and check for some generic always-present pass like ModuleVerifier?

twoh updated this revision to Diff 214855.Aug 13 2019, 9:23 AM

Avoid -O2 from the test.

twoh added a comment.Aug 13 2019, 9:25 AM

@fedor.sergeev Sorry for the late reply. I missed your comment.

I found that with the new pass manager module verifier is not scheduled by default, and AlwaysInlinerPass is the only one scheduled if I provide no -O option. I removed -O2 from the test command and replaced ForceFunctionAttrPass to AlwaysInlinerPass.

Thanks!

fedor.sergeev accepted this revision.Aug 13 2019, 11:54 PM

LGTM.
Thanks for addressing this!

This revision is now accepted and ready to land.Aug 13 2019, 11:54 PM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptAug 14 2019, 12:12 AM