Index: llvm/include/llvm/TableGen/Record.h =================================================================== --- llvm/include/llvm/TableGen/Record.h +++ llvm/include/llvm/TableGen/Record.h @@ -1829,7 +1829,7 @@ /// Stop timing a phase. void stopTimer(); - /// Start timing the overall backend. If the backend starts a timer, + /// Start timing the overall backend. If the backend itself starts a timer, /// then this timer is cleared. void startBackendTimer(StringRef Name); Index: llvm/lib/Support/Timer.cpp =================================================================== --- llvm/lib/Support/Timer.cpp +++ llvm/lib/Support/Timer.cpp @@ -53,6 +53,11 @@ InfoOutputFilename("info-output-file", cl::value_desc("filename"), cl::desc("File to append -stats and -timer output to"), cl::Hidden, cl::location(getLibSupportInfoOutputFilename())); + + static cl::opt + SortTimers("sort-timers", cl::desc("In the report, sort the timers in each group " + "in wall clock time order"), + cl::init(true), cl::Hidden); } std::unique_ptr llvm::CreateInfoOutputFile() { @@ -301,8 +306,9 @@ } void TimerGroup::PrintQueuedTimers(raw_ostream &OS) { - // Sort the timers in descending order by amount of time taken. - llvm::sort(TimersToPrint); + // Perhaps sort the timers in descending order by amount of time taken. + if (SortTimers) + llvm::sort(TimersToPrint); TimeRecord Total; for (const PrintRecord &Record : TimersToPrint) Index: llvm/utils/TableGen/DAGISelEmitter.cpp =================================================================== --- llvm/utils/TableGen/DAGISelEmitter.cpp +++ llvm/utils/TableGen/DAGISelEmitter.cpp @@ -189,6 +189,7 @@ namespace llvm { void EmitDAGISel(RecordKeeper &RK, raw_ostream &OS) { + RK.startTimer("Parse patterns"); DAGISelEmitter(RK).run(OS); }