This is an archive of the discontinued LLVM Phabricator instance.

[llc] Use -filetype=null to disable MIR printing
ClosedPublic

Authored by foad on Oct 15 2020, 8:55 AM.

Details

Summary

If you use -stop-after or similar options, llc will normally print MIR.
This patch checks for -filetype=null as a special case to disable MIR
printing. As the comment says, "The Null output is intended for use for
performance analysis ...", and I found this useful for timing a subset
of the passes that llc runs without the significant overhead of printing
MIR just to send it to /dev/null.

Diff Detail

Event Timeline

foad created this revision.Oct 15 2020, 8:55 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 15 2020, 8:55 AM
foad requested review of this revision.Oct 15 2020, 8:55 AM
MaskRay added inline comments.Oct 15 2020, 9:29 AM
llvm/lib/CodeGen/LLVMTargetMachine.cpp
203

Just say createPrintMIRPass is redundant for null output?

How much overhead have you measured?

llvm/test/tools/llc/filetype-null-stop-after.ll
2

| count 0

foad added inline comments.Oct 15 2020, 9:42 AM
llvm/lib/CodeGen/LLVMTargetMachine.cpp
203

How much overhead have you measured?

More than 50% in MIR printing in cases like this:

$ ~/llvm-release/bin/llc -march=aarch64 sqlite3.bc -filetype=null -stop-after=finalize-isel -time-passes > /dev/null
===-------------------------------------------------------------------------===
                      ... Pass execution timing report ...
===-------------------------------------------------------------------------===
  Total Execution Time: 4.7993 seconds (4.8033 wall clock)

   ---User Time---   --System Time--   --User+System--   ---Wall Time---  --- Name ---
   2.5278 ( 54.2%)   0.0577 ( 42.8%)   2.5856 ( 53.9%)   2.5887 ( 53.9%)  MIR Printing Pass
   1.3541 ( 29.0%)   0.0530 ( 39.3%)   1.4071 ( 29.3%)   1.4081 ( 29.3%)  AArch64 Instruction Selection
   0.1636 (  3.5%)   0.0024 (  1.8%)   0.1660 (  3.5%)   0.1661 (  3.5%)  CodeGen Prepare
...
foad updated this revision to Diff 298565.Oct 16 2020, 1:34 AM

Address feedback.

MaskRay accepted this revision.Oct 16 2020, 8:40 AM

LGTM.

This revision is now accepted and ready to land.Oct 16 2020, 8:40 AM
This revision was landed with ongoing or failed builds.Oct 16 2020, 9:04 AM
This revision was automatically updated to reflect the committed changes.