Index: COFF/Driver.cpp =================================================================== --- COFF/Driver.cpp +++ COFF/Driver.cpp @@ -30,6 +30,7 @@ #include "llvm/Support/Process.h" #include "llvm/Support/TarWriter.h" #include "llvm/Support/TargetSelect.h" +#include "llvm/Support/Timer.h" #include "llvm/Support/raw_ostream.h" #include "llvm/ToolDrivers/llvm-lib/LibDriver.h" #include @@ -1075,6 +1076,10 @@ // This is useful because MSVC link.exe can generate complete PDBs. if (Args.hasArg(OPT_msvclto)) { invokeMSVC(Args); + + // If any timers were active, print their results now. + TimerGroup::printAll(errs()); + exit(0); } @@ -1126,6 +1131,9 @@ // Write the result. writeResult(&Symtab); + // If any timers were active, print their results now. + TimerGroup::printAll(errs()); + // Call exit to avoid calling destructors. exit(0); } Index: test/COFF/timepasses.ll =================================================================== --- /dev/null +++ test/COFF/timepasses.ll @@ -0,0 +1,15 @@ +; RUN: llvm-as %s -o %t.obj +; RUN: lld-link /entry:main /out:%t.exe %t.obj /mllvm:-time-passes 2>&1 | FileCheck %s + +; RUN: lld-link /entry:main /out:%t2.exe %t.obj /msvclto /opt:lldlto=1 \ +; RUN: /mllvm:-time-passes 2> %t.log +; RUN: FileCheck %s < %t.log + +target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-pc-windows-msvc" + +define void @main() { + ret void +} + +; CHECK: Total Execution Time