summaryrefslogtreecommitdiff
path: root/lib/Frontend/CompilerInvocation.cpp
diff options
context:
space:
mode:
authorAdam Nemet <anemet@apple.com>2016-09-13 04:32:40 +0000
committerAdam Nemet <anemet@apple.com>2016-09-13 04:32:40 +0000
commit8a7af2f320b4136f51d211cfc47c785945abfb12 (patch)
treed7d9add7fb259f8ef7a5f553a305134fc8fc0cb2 /lib/Frontend/CompilerInvocation.cpp
parente3a335ebd724f0ee206658bd19c571bdd5204c15 (diff)
downloadclang-8a7af2f320b4136f51d211cfc47c785945abfb12.tar.gz
Reapply r281276 with passing -emit-llvm in one of the tests
Original commit message: Add -fdiagnostics-show-hotness Summary: I've recently added the ability for optimization remarks to include the hotness of the corresponding code region. This uses PGO and allows filtering of the optimization remarks by relevance. The idea was first discussed here: http://thread.gmane.org/gmane.comp.compilers.llvm.devel/98334 The general goal is to produce a YAML file with the remarks. Then, an external tool could dynamically filter these by hotness and perhaps by other things. That said it makes sense to also expose this at the more basic level where we just include the hotness info with each optimization remark. For example, in D22694, the clang flag was pretty useful to measure the overhead of the additional analyses required to include hotness. (Without the flag we don't even run the analyses.) For the record, Hal has already expressed support for the idea of this patch on IRC. Differential Revision: https://reviews.llvm.org/D23284 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@281293 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Frontend/CompilerInvocation.cpp')
-rw-r--r--lib/Frontend/CompilerInvocation.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/Frontend/CompilerInvocation.cpp b/lib/Frontend/CompilerInvocation.cpp
index 619ea9cc23..1536738c92 100644
--- a/lib/Frontend/CompilerInvocation.cpp
+++ b/lib/Frontend/CompilerInvocation.cpp
@@ -839,6 +839,12 @@ static bool ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, InputKind IK,
NeedLocTracking = true;
}
+ Opts.DiagnosticsWithHotness =
+ Args.hasArg(options::OPT_fdiagnostics_show_hotness);
+ if (Opts.DiagnosticsWithHotness &&
+ Opts.getProfileUse() == CodeGenOptions::ProfileNone)
+ Diags.Report(diag::warn_drv_fdiagnostics_show_hotness_requires_pgo);
+
// If the user requested to use a sample profile for PGO, then the
// backend will need to track source location information so the profile
// can be incorporated into the IR.