This is an archive of the discontinued LLVM Phabricator instance.

Stop IR Dumps occurring after MachineVerifier
Needs ReviewPublic

Authored by dsanders on Jul 12 2019, 4:50 PM.

Details

Reviewers
czhang
chandlerc
Summary

-print-after-all and -print-before-all print after/before each pass.
Unfortunately this includes the MachineVerifier which doesn't make
any changes or produce any information. The end result is that one of these
options in combination with -verify-machineinstrs cause identical MIR to be
dumped twice for each pass (four times if you use both).

I'm not very familiar with the Pass manager infrastructure but this hack
introduces the concept of a verifier pass which does not trigger additional
IR Dumps.

Diff Detail

Event Timeline

dsanders created this revision.Jul 12 2019, 4:50 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 12 2019, 4:50 PM
Herald added a subscriber: mehdi_amini. · View Herald Transcript

This probably isn't the right way to go about it as it's adding to Pass rather than PassInfo but hopefully someone more familiar with this area can point me in the right direction.

Seems like the same reasoning could apply to any type of immutable pass, not just verifier passes. It seems a little ad-hoc to single out the machine verifier pass for IR dumping. The benefit of treating all immutable passes this way is that one can simply disable printing based on class.

Seems like the same reasoning could apply to any type of immutable pass, not just verifier passes. It seems a little ad-hoc to single out the machine verifier pass for IR dumping. The benefit of treating all immutable passes this way is that one can simply disable printing based on class.

I agree but ImmutablePasses already avoid printing the IR as they go into the if-statement on line 775 which returns on line 784 before we get to the code that adds the printers. MachineVerifierPass is somewhat special in that it has the effect of an ImmutablePass but needs to be run like a normal pass. It's a MachineFunctionPass so that it's inserted between each pass without needing anyone/everyone to call getAnalysis<MachineVerifierPass>() and it can't be skipped by setPreservesAll() like an ImmutablePass can. However, it doesn't actually change the IR so it doesn't make sense to print the IR before/after it like other MachineFunctionPasses.