This is an archive of the discontinued LLVM Phabricator instance.

Add new option choices for print-changed that do not output llc changes.
Needs ReviewPublic

Authored by jamieschmeiser on Nov 21 2022, 1:03 PM.

Details

Reviewers
MaskRay
aeubanks
Summary

When looking at the opt pipeline as part of a compiler invocation (eg, using
clang++ -mllvm -print-changed=cdiff), I am being overwhelmed with the output from
llc...

Add extra option choices for print-changed, corresponding to the current
choices with a prefix of opt- which do not cause printing in llc.

Also, suppress printing in llc for dot-cfg and dot-cfg-quiet instead of quiet mode.

Diff Detail

Event Timeline

jamieschmeiser created this revision.Nov 21 2022, 1:03 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 21 2022, 1:03 PM
jamieschmeiser requested review of this revision.Nov 21 2022, 1:03 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 21 2022, 1:03 PM
MaskRay added inline comments.Nov 21 2022, 1:29 PM
llvm/include/llvm/IR/PrintPasses.h
37

The number of modes is massive. Shall we use another option to indicate the intent (only show non-codegen passes)?

llvm/lib/CodeGen/MachineFunctionPass.cpp
131

I think we should keep enumerating all values to ensure a new mode does not silently get unhandled here.

if clang is giving you too much, you can always not run the backend passes with -emit-llvm when debugging

llvm/include/llvm/IR/PrintPasses.h
37

agreed, this is growing exponentially because it really should be multiple flags

something like
print-changed
print-changed-diff[=color]
print-ir-pass-changed (default true)
print-mir-pass-changed (default true)
print-dotcfg
print-changed-verbose (affects all change printers)
...

this will allow users to specify more than one change printer at once which I think is fine (could manually error out if not desired, but I don't think that's necessary)

jamieschmeiser added inline comments.Nov 22 2022, 5:31 AM
llvm/include/llvm/IR/PrintPasses.h
37

My first thought was to change the llc versions to print-llc-changed but I didn't want to propose changing a functionality that others may want (ie, having both come out with one option). I think having the two piggy-back on the same option is too much. The filtering options can be overloaded. What about the following?
print-changed[=diff|=cdiff] (both)
print-ir-changed[=diff|=cdiff]
print-mir-changed[=diff|=cdiff]
print-dotcfg
print-changed-verbose (defaults to false, affects all change printers)

The print-changed-verbose default could also be controlled by an environment variable

__LLVM_PRINT_CHANGED_VERBOSE_DEFAULT__==TRUE

(is there precedence?, better name?)

llvm/lib/CodeGen/MachineFunctionPass.cpp
131

Fine with me. I'll work that up

MaskRay added inline comments.Nov 27 2022, 8:48 PM
llvm/include/llvm/IR/PrintPasses.h
37

An environment variable for a debugging feature is too much. Users should know that the functionality is unstable like any other API, and perhaps more unstable since this is a debugging feature.

jamieschmeiser marked an inline comment as not done.Dec 2 2022, 8:14 AM
jamieschmeiser added inline comments.
llvm/include/llvm/IR/PrintPasses.h
37

@MaskRay @aeubanks I was just suggesting the environment variable as a way of customizing the option to avoid typing and am fine with dropping that idea. I am more interested in agreement about the proposed options. If there is concensus, I will make the appropriate changes but it makes sense to me to get agreement before spending the time making the code changes.