This is an archive of the discontinued LLVM Phabricator instance.

Reduce the size of output with -print-before/after-all by avoid duplicated dump
AbandonedPublic

Authored by inouehrs on Jun 5 2017, 1:42 AM.

Details

Reviewers
None
Summary

The IR transformation log generated with -print-before/after-all is essential information to understand the LLVM behavior.
However, the size of the output often becomes quite large.
This patch reduces the size of the output by avoiding print the detail if the function is not modified by a previous pass. This functionality is controlled by -omit-duplicated-dump option and is not enabled by default.
Since, there is many passes that do not modify functions (including analysis passes), the size of output becomes about half in many cases.

If the function is not modified, output looks like as follow:

*** IR Dump After Global Value Numbering ***
; Function Attrs: norecurse nounwind uwtable
define i32 @main() local_unnamed_addr #2 {
  listing omitted because it is not modified since last dump.
}
# *** IR Dump After StackMap Liveness Analysis ***:
# Machine code for function main: NoPHIs, TracksLiveness, NoVRegs

  listing omitted because it is not modified since last dump.

# End machine code for function main.

Diff Detail

Event Timeline

inouehrs created this revision.Jun 5 2017, 1:42 AM

This looks useful. One suggestion might be to change this diagnostic:

listing omitted because it is not modified since last dump.

To someting more greppable, such as:

Pass "StackMap Liveness Analysis" did not modify the IR

Could be useful, but that seems a bit intrusive right now (ad-hoc hooks in Module and PassManager)

lib/IR/Module.cpp
96

Why aren't you using a smart pointer?

inouehrs updated this revision to Diff 101575.Jun 6 2017, 8:56 AM
  • rewrite using a smart pointer.
  • try to make the changes looking less intrusive in PassManagers.
inouehrs marked an inline comment as done.Jun 6 2017, 9:06 AM

@mehdi_amini I want to be less intrusive especially in Module. I like to pack most of the changes in PMDataManager to be less intrusive in Module, but I cannot find a good way to access PMDataManager (i.e. PassManager) from AsmWriter. I appreciate any further suggestions.

@npjdesres Your suggested output looks quite nice. But I do not implement it so far because I need to be add further code to record the last pass without modification. I am investigating a good way to improve the message.

lib/IR/Module.cpp
96

I rewrote the change in Module with a smart pointer.

inouehrs abandoned this revision.Jul 21 2017, 6:14 AM
inouehrs marked an inline comment as done.

I like to redesign this. Thank you for advises.