OSDN Git Service

[Time-report] Add a flag -ftime-report={per-pass,per-pass-run} to control the pass...
authorYuanfang Chen <yuanfang.chen@sony.com>
Wed, 2 Dec 2020 18:18:18 +0000 (10:18 -0800)
committerYuanfang Chen <yuanfang.chen@sony.com>
Tue, 8 Dec 2020 18:13:19 +0000 (10:13 -0800)
commit1821265db681cd2289fce9331e3aed26bdf814e3
treeb5cea61adf7205e690f0f34170cfe35bb0399d4c
parentc6348e8c95ee1eaa9dd2322b278def7a4127ff26
[Time-report] Add a flag -ftime-report={per-pass,per-pass-run} to control the pass timing aggregation

Currently, -ftime-report + new pass manager emits one line of report for each
pass run. This potentially causes huge output text especially with regular LTO
or large single file (Obeserved in private tests and was reported in D51276).
The behaviour of -ftime-report + legacy pass manager is
emitting one line of report for each pass object which has relatively reasonable
text output size. This patch adds a flag `-ftime-report=` to control time report
aggregation for new pass manager.

The flag is for new pass manager only. Using it with legacy pass manager gives
an error. It is a driver and cc1 flag. `per-pass` is the new default so
`-ftime-report` is aliased to `-ftime-report=per-pass`. Before this patch,
functionality-wise `-ftime-report` is aliased to `-ftime-report=per-pass-run`.

* Adds an boolean variable TimePassesHandler::PerRun to control per-pass vs per-pass-run.
* Adds a new clang CodeGen flag CodeGenOptions::TimePassesPerRun to work with the existing CodeGenOptions::TimePasses.
* Remove FrontendOptions::ShowTimers, its uses are replaced by the existing CodeGenOptions::TimePasses.
* Remove FrontendTimesIsEnabled (It was introduced in D45619 which was largely reverted.)

Differential Revision: https://reviews.llvm.org/D92436
17 files changed:
clang/include/clang/Basic/CodeGenOptions.def
clang/include/clang/Driver/Options.td
clang/include/clang/Frontend/FrontendOptions.h
clang/include/clang/Frontend/Utils.h
clang/lib/CodeGen/BackendUtil.cpp
clang/lib/CodeGen/CodeGenAction.cpp
clang/lib/Driver/ToolChains/Clang.cpp
clang/lib/Frontend/CMakeLists.txt
clang/lib/Frontend/CompilerInstance.cpp
clang/lib/Frontend/CompilerInvocation.cpp
clang/lib/Frontend/FrontendTiming.cpp [deleted file]
clang/test/Driver/time-report.c [new file with mode: 0644]
clang/test/Misc/time-passes.c [new file with mode: 0644]
llvm/include/llvm/IR/PassTimingInfo.h
llvm/include/llvm/Pass.h
llvm/lib/IR/PassTimingInfo.cpp
llvm/test/Other/time-passes.ll