aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/LTO/LTOBackend.cpp
diff options
context:
space:
mode:
authormacurtis-amd <macurtis@amd.com>2024-07-29 14:56:43 -0500
committerGitHub <noreply@github.com>2024-07-29 15:56:43 -0400
commit26e455bac0c44d75cb5d544c35e7c8326c91b4f3 (patch)
treef16efa643e032ccd8024d0193adc3eb6483bbe8e /llvm/lib/LTO/LTOBackend.cpp
parent2a612a1b343dcc0d3dd44df4866f6c6af5cc090f (diff)
downloadllvm-26e455bac0c44d75cb5d544c35e7c8326c91b4f3.zip
llvm-26e455bac0c44d75cb5d544c35e7c8326c91b4f3.tar.gz
llvm-26e455bac0c44d75cb5d544c35e7c8326c91b4f3.tar.bz2
[lld][LTO] Teach LTO to print pipeline passes (#101018)
I found this useful while debugging code generation differences between old and new offloading drivers. No functional change (intended).
Diffstat (limited to 'llvm/lib/LTO/LTOBackend.cpp')
-rw-r--r--llvm/lib/LTO/LTOBackend.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/llvm/lib/LTO/LTOBackend.cpp b/llvm/lib/LTO/LTOBackend.cpp
index d5d642f..effaed2 100644
--- a/llvm/lib/LTO/LTOBackend.cpp
+++ b/llvm/lib/LTO/LTOBackend.cpp
@@ -335,6 +335,16 @@ static void runNewPMPasses(const Config &Conf, Module &Mod, TargetMachine *TM,
if (!Conf.DisableVerify)
MPM.addPass(VerifierPass());
+ if (PrintPipelinePasses) {
+ std::string PipelineStr;
+ raw_string_ostream OS(PipelineStr);
+ MPM.printPipeline(OS, [&PIC](StringRef ClassName) {
+ auto PassName = PIC.getPassNameForClassName(ClassName);
+ return PassName.empty() ? ClassName : PassName;
+ });
+ outs() << "pipeline-passes: " << PipelineStr << '\n';
+ }
+
MPM.run(Mod, MAM);
}