This is an archive of the discontinued LLVM Phabricator instance.

[LTO] [Legacy] Add -debug-pass-manager option to enable pass run/skip trace.
ClosedPublic

Authored by w2yehia on Sep 20 2021, 8:04 AM.

Diff Detail

Event Timeline

w2yehia created this revision.Sep 20 2021, 8:04 AM
w2yehia requested review of this revision.Sep 20 2021, 8:04 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 20 2021, 8:04 AM
w2yehia updated this revision to Diff 373612.Sep 20 2021, 8:50 AM
w2yehia added reviewers: steven_wu, fhahn.
This revision is now accepted and ready to land.Sep 20 2021, 9:06 AM
fhahn requested changes to this revision.Sep 20 2021, 9:08 AM

Could you add a test case?

This revision now requires changes to proceed.Sep 20 2021, 9:08 AM
w2yehia updated this revision to Diff 373689.Sep 20 2021, 12:27 PM

Common up the -debug-pass-manager option between LTOCodeGenerator, llvm-lto (which uses LTOCodeGenerator), and llvm-lto2 (which does not use LTOCodeGenerator but uses libLLVMLTO).
Add testcase.

tejohnson added inline comments.
llvm/lib/LTO/LTOCodeGenerator.cpp
135

Needed in ThinLTOCodeGenerator.cpp too? Looks like it is passed down from llvm-lto to there but I assume you wanted to set this via the linker? Not a legacy LTO user though, @steven_wu may have more thoughts.

llvm/tools/llvm-lto2/llvm-lto2.cpp
172

It seems a little odd to have the new LTO tool rely on an option in the legacy LTO. Maybe the def should be moved to LTO.cpp which is the new LTO and which the legacy LTO is gradually starting to use?

I assume this is a debug option for LTO developer that is not going for production. That is why I said LGTM without a test case. I do think it will be good to set that in ThinLTOCodeGenerator as well, probably not needed for llvm-lto2.

I assume this is a debug option for LTO developer that is not going for production. That is why I said LGTM without a test case. I do think it will be good to set that in ThinLTOCodeGenerator as well, probably not needed for llvm-lto2.

The same option was already in llvm-lto2, but the more recent version of the patch removed the option from there and changed it to use the copy in LTOCodeGenerator.cpp, which I don't think is a good idea.

w2yehia added inline comments.Sep 20 2021, 9:15 PM
llvm/lib/LTO/LTOCodeGenerator.cpp
135

Yep, I intend to pass this option via the linker. Sorry for keep forgetting about thinLTO; we don't use it yet.

If we are to add processing of the DebugPassManager cl::opt to ThinLTOCodeGenerator then we'll have to remove it from llvm-lto, and remove the DebugPassManager parameter from a bunch of static functions in ThinLTOCodeGenerator.cpp.

@fhahn FYI, since you added that code.

llvm/tools/llvm-lto2/llvm-lto2.cpp
172

Moving the option's def to LTO.cpp makes sense.

w2yehia updated this revision to Diff 373778.Sep 20 2021, 9:16 PM
fhahn added inline comments.Sep 21 2021, 2:40 PM
llvm/lib/LTO/LTOCodeGenerator.cpp
135

Thanks that should be fine.

w2yehia updated this revision to Diff 374222.Sep 22 2021, 7:06 AM

clang-format

the pre-merge build failures are noise (an NFC change has the same failures)

steven_wu accepted this revision.Sep 27 2021, 11:38 AM
fhahn accepted this revision.Sep 27 2021, 11:42 AM

LGTM thanks!

This revision is now accepted and ready to land.Sep 27 2021, 11:42 AM
This revision was landed with ongoing or failed builds.Sep 29 2021, 5:18 AM
This revision was automatically updated to reflect the committed changes.
sbc100 added a subscriber: sbc100.Sep 29 2021, 9:22 AM

I bisected a breakage in our auto-roller to this change. I seems that in DLLVM_LINK_LLVM_DYLIB mode this break the opt command:

$ opt -internalize -internalize-public-api-list=main -globaldce test.o -o test2.o
: CommandLine Error: Option 'debug-pass-manager' registered more than once!
LLVM ERROR: inconsistency in registered CommandLine options

Our auto-roller that is failing is at https://autoroll.skia.org/r/llvm-project-emscripten-releases.

I bisected a breakage in our auto-roller to this change. I seems that in DLLVM_LINK_LLVM_DYLIB mode this break the opt command:

$ opt -internalize -internalize-public-api-list=main -globaldce test.o -o test2.o
: CommandLine Error: Option 'debug-pass-manager' registered more than once!
LLVM ERROR: inconsistency in registered CommandLine options

Our auto-roller that is failing is at https://autoroll.skia.org/r/llvm-project-emscripten-releases.

This is currently blocking llvm changes from getting into new emscripten releases. Perhaps we can revert?

I bisected a breakage in our auto-roller to this change. I seems that in DLLVM_LINK_LLVM_DYLIB mode this break the opt command:

$ opt -internalize -internalize-public-api-list=main -globaldce test.o -o test2.o
: CommandLine Error: Option 'debug-pass-manager' registered more than once!
LLVM ERROR: inconsistency in registered CommandLine options

Our auto-roller that is failing is at https://autoroll.skia.org/r/llvm-project-emscripten-releases.

This is currently blocking llvm changes from getting into new emscripten releases. Perhaps we can revert?

reverted.