diff options
author | Vedant Kumar <vsk@apple.com> | 2017-04-27 17:30:58 +0000 |
---|---|---|
committer | Vedant Kumar <vsk@apple.com> | 2017-04-27 17:30:58 +0000 |
commit | 96d6ca7e8c4f6bce55134c2fca66fb9747ecfde8 (patch) | |
tree | 0aa691bab9cc77d1dda6a77ef089dffa1b1a35f1 /clang/test/Profile/c-outdated-data.c | |
parent | d36820f1edf4b5216f0fd42b28ae24dd0e2f0e94 (diff) | |
download | bcm5719-llvm-96d6ca7e8c4f6bce55134c2fca66fb9747ecfde8.tar.gz bcm5719-llvm-96d6ca7e8c4f6bce55134c2fca66fb9747ecfde8.zip |
[Profile] Add off-by-default -Wprofile-instr-missing warning
Clang warns that a profile is out-of-date if it can't find a profile
record for any function in a TU. This warning became noisy after llvm
started allowing dead-stripping of instrumented functions.
To fix this, this patch changes the existing profile out-of-date warning
(-Wprofile-instr-out-of-date) so that it only complains about mismatched
data. Further, it introduces a new, off-by-default warning about missing
function data (-Wprofile-instr-missing).
Differential Revision: https://reviews.llvm.org/D28867
llvm-svn: 301570
Diffstat (limited to 'clang/test/Profile/c-outdated-data.c')
-rw-r--r-- | clang/test/Profile/c-outdated-data.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/clang/test/Profile/c-outdated-data.c b/clang/test/Profile/c-outdated-data.c index e61ad02d075..b686f94d804 100644 --- a/clang/test/Profile/c-outdated-data.c +++ b/clang/test/Profile/c-outdated-data.c @@ -4,23 +4,23 @@ // doesn't play well with warnings that have no line number. // RUN: llvm-profdata merge %S/Inputs/c-outdated-data.proftext -o %t.profdata -// RUN: %clang_cc1 -triple x86_64-apple-macosx10.9 -main-file-name c-outdated-data.c %s -o /dev/null -emit-llvm -fprofile-instrument-use-path=%t.profdata -Wprofile-instr-dropped 2>&1 | FileCheck %s -// CHECK: warning: profile data may be out of date: of 3 functions, 1 has no data and 1 has mismatched data that will be ignored +// RUN: %clang_cc1 -triple x86_64-apple-macosx10.9 -main-file-name c-outdated-data.c %s -o /dev/null -emit-llvm -fprofile-instrument-use-path=%t.profdata 2>&1 | FileCheck %s -check-prefix=NO_MISSING +// RUN: %clang_cc1 -triple x86_64-apple-macosx10.9 -main-file-name c-outdated-data.c %s -o /dev/null -emit-llvm -Wprofile-instr-missing -fprofile-instrument-use-path=%t.profdata 2>&1 | FileCheck %s -check-prefix=WITH_MISSING + +// NO_MISSING: warning: profile data may be out of date: of 3 functions, 1 has mismatched data that will be ignored +// NO_MISSING-NOT: 1 has no data + +// WITH_MISSING: warning: profile data may be out of date: of 3 functions, 1 has mismatched data that will be ignored +// WITH_MISSING: warning: profile data may be incomplete: of 3 functions, 1 has no data void no_usable_data() { int i = 0; if (i) {} - -#ifdef GENERATE_OUTDATED_DATA - if (i) {} -#endif } -#ifndef GENERATE_OUTDATED_DATA void no_data() { } -#endif int main(int argc, const char *argv[]) { no_usable_data(); |