mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-25 04:02:41 +01:00
[llvm-profdata] Make diagnostics consistent with the (no capitalization, no period) style
The format is currently inconsistent. Use the https://llvm.org/docs/CodingStandards.html#error-and-warning-messages style. And add `error:` or `warning:` to CHECK lines wherever appropriate.
This commit is contained in:
parent
e2a2115bff
commit
2fe891f533
@ -77,47 +77,48 @@ static cl::opt<unsigned> StaticFuncStripDirNamePrefix(
|
||||
static std::string getInstrProfErrString(instrprof_error Err) {
|
||||
switch (Err) {
|
||||
case instrprof_error::success:
|
||||
return "Success";
|
||||
return "success";
|
||||
case instrprof_error::eof:
|
||||
return "End of File";
|
||||
return "end of File";
|
||||
case instrprof_error::unrecognized_format:
|
||||
return "Unrecognized instrumentation profile encoding format";
|
||||
return "unrecognized instrumentation profile encoding format";
|
||||
case instrprof_error::bad_magic:
|
||||
return "Invalid instrumentation profile data (bad magic)";
|
||||
return "invalid instrumentation profile data (bad magic)";
|
||||
case instrprof_error::bad_header:
|
||||
return "Invalid instrumentation profile data (file header is corrupt)";
|
||||
return "invalid instrumentation profile data (file header is corrupt)";
|
||||
case instrprof_error::unsupported_version:
|
||||
return "Unsupported instrumentation profile format version";
|
||||
return "unsupported instrumentation profile format version";
|
||||
case instrprof_error::unsupported_hash_type:
|
||||
return "Unsupported instrumentation profile hash type";
|
||||
return "unsupported instrumentation profile hash type";
|
||||
case instrprof_error::too_large:
|
||||
return "Too much profile data";
|
||||
return "too much profile data";
|
||||
case instrprof_error::truncated:
|
||||
return "Truncated profile data";
|
||||
return "truncated profile data";
|
||||
case instrprof_error::malformed:
|
||||
return "Malformed instrumentation profile data";
|
||||
return "malformed instrumentation profile data";
|
||||
case instrprof_error::invalid_prof:
|
||||
return "Invalid profile created. Please file a bug "
|
||||
return "invalid profile created. Please file a bug "
|
||||
"at: " BUG_REPORT_URL
|
||||
" and include the profraw files that caused this error.";
|
||||
case instrprof_error::unknown_function:
|
||||
return "No profile data available for function";
|
||||
return "no profile data available for function";
|
||||
case instrprof_error::hash_mismatch:
|
||||
return "Function control flow change detected (hash mismatch)";
|
||||
return "function control flow change detected (hash mismatch)";
|
||||
case instrprof_error::count_mismatch:
|
||||
return "Function basic block count change detected (counter mismatch)";
|
||||
return "function basic block count change detected (counter mismatch)";
|
||||
case instrprof_error::counter_overflow:
|
||||
return "Counter overflow";
|
||||
return "counter overflow";
|
||||
case instrprof_error::value_site_count_mismatch:
|
||||
return "Function value site count change detected (counter mismatch)";
|
||||
return "function value site count change detected (counter mismatch)";
|
||||
case instrprof_error::compress_failed:
|
||||
return "Failed to compress data (zlib)";
|
||||
return "failed to compress data (zlib)";
|
||||
case instrprof_error::uncompress_failed:
|
||||
return "Failed to uncompress data (zlib)";
|
||||
return "failed to uncompress data (zlib)";
|
||||
case instrprof_error::empty_raw_profile:
|
||||
return "Empty raw profile file";
|
||||
return "empty raw profile file";
|
||||
case instrprof_error::zlib_unavailable:
|
||||
return "Profile uses zlib compression but the profile reader was built without zlib support";
|
||||
return "profile uses zlib compression but the profile reader was built "
|
||||
"without zlib support";
|
||||
}
|
||||
llvm_unreachable("A value of instrprof_error has no message.");
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
; RUN: opt < %s -pgo-instr-use -pgo-test-profile-file=%t.profdata -S 2>&1 | FileCheck %s
|
||||
; RUN: opt < %s -passes=pgo-instr-use -pgo-test-profile-file=%t.profdata -S 2>&1 | FileCheck %s
|
||||
|
||||
; CHECK: Function control flow change detected (hash mismatch) foo
|
||||
; CHECK: warning: {{.+}}: function control flow change detected (hash mismatch) foo
|
||||
|
||||
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
|
||||
target triple = "x86_64-unknown-linux-gnu"
|
||||
|
@ -5,8 +5,8 @@
|
||||
; RUN: opt < %s -pgo-instr-use -pgo-test-profile-file=%t.profdata -S 2>&1 | FileCheck %s --check-prefix=DEFAULT
|
||||
; RUN: opt < %s -passes=pgo-instr-use -pgo-test-profile-file=%t.profdata -S 2>&1 | FileCheck %s --check-prefix=DEFAULT
|
||||
|
||||
; CHECK: No profile data available for function bar
|
||||
; DEFAULT-NOT: No profile data available for function bar
|
||||
; CHECK: warning: {{.+}}: no profile data available for function bar
|
||||
; DEFAULT-NOT: no profile data available for function bar
|
||||
|
||||
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
|
||||
target triple = "x86_64-unknown-linux-gnu"
|
||||
|
@ -14,7 +14,7 @@ foo
|
||||
|
||||
# The hash matches, but we can't combine these because the number of
|
||||
# counters differs.
|
||||
# MERGE_ERRS: count-mismatch.proftext: foo: Function basic block count change detected (counter mismatch)
|
||||
# MERGE_ERRS: count-mismatch.proftext: foo: function basic block count change detected (counter mismatch)
|
||||
# MERGE_ERRS: Make sure that all profile data to be merged is generated from the same binary.
|
||||
foo
|
||||
1024
|
||||
|
@ -21,8 +21,8 @@ RUN: echo "1" >> %t.input
|
||||
RUN: echo ":10" >> %t.input
|
||||
|
||||
RUN: not llvm-profdata merge %t.input -text -output=/dev/null 2>&1 | FileCheck %s --check-prefix=BROKEN
|
||||
BROKEN: warning: {{.*}}invalid-profdata.test.tmp.input: Malformed instrumentation profile data
|
||||
BROKEN-NEXT: error: No profiles could be merged.
|
||||
BROKEN: warning: {{.*}}invalid-profdata.test.tmp.input: malformed instrumentation profile data
|
||||
BROKEN-NEXT: error: no profile can be merged
|
||||
|
||||
RUN: echo ":ir" > %t.input
|
||||
RUN: echo "_ZN6Thread5StartEv" >> %t.input
|
||||
|
@ -1,7 +1,7 @@
|
||||
# RUN: llvm-profdata merge --text -j 4 %s %s %s %s -o %t 2>&1 | FileCheck %s
|
||||
# RUN: llvm-profdata merge --binary -j 4 %s %s %s %s -o %t 2>&1 | FileCheck %s
|
||||
# IR level Instrumentation Flag
|
||||
# CHECK: Invalid profile
|
||||
# CHECK: warning: invalid profile created
|
||||
:ir
|
||||
foo
|
||||
# Func Hash:
|
||||
|
@ -51,4 +51,5 @@ RUN: printf '\101\0\0\0\0\0\0\0' >> %t.profraw
|
||||
RUN: printf '\3\0bar\0\0\0' >> %t.profraw
|
||||
|
||||
RUN: not llvm-profdata merge -o /dev/null %t.profraw 2>&1 | FileCheck %s
|
||||
CHECK: Malformed instrumentation profile data
|
||||
CHECK: warning: {{.+}}: malformed instrumentation profile data
|
||||
CHECK: error: no profile can be merged
|
||||
|
@ -3,13 +3,13 @@ Tests for overflow when merging instrumented profiles.
|
||||
1- Merge profile having maximum counts with itself and verify overflow detected and saturation occurred
|
||||
RUN: llvm-profdata merge -instr %p/Inputs/overflow-instr.proftext %p/Inputs/overflow-instr.proftext -o %t.out 2>&1 | FileCheck %s -check-prefix=MERGE_OVERFLOW
|
||||
RUN: llvm-profdata show -instr -all-functions -counts %t.out | FileCheck %s --check-prefix=SHOW_OVERFLOW
|
||||
MERGE_OVERFLOW: {{.*}}: overflow: Counter overflow
|
||||
MERGE_OVERFLOW: {{.*}}.proftext: overflow: counter overflow
|
||||
SHOW_OVERFLOW: Function count: 18446744073709551615
|
||||
SHOW_OVERFLOW-NEXT: Block counts: [18446744073709551615, 18446744073709551615]
|
||||
|
||||
2- Merge profile having maximum counts by itself and verify no overflow
|
||||
RUN: llvm-profdata merge -instr %p/Inputs/overflow-instr.proftext -o %t.out 2>&1 | FileCheck %s -check-prefix=MERGE_NO_OVERFLOW -allow-empty
|
||||
RUN: llvm-profdata show -instr -all-functions -counts %t.out | FileCheck %s --check-prefix=SHOW_NO_OVERFLOW
|
||||
MERGE_NO_OVERFLOW-NOT: {{.*}}: overflow: Counter overflow
|
||||
MERGE_NO_OVERFLOW-NOT: {{.*}}.proftext: overflow: counter overflow
|
||||
SHOW_NO_OVERFLOW: Function count: 18446744073709551615
|
||||
SHOW_NO_OVERFLOW-NEXT: Block counts: [9223372036854775808, 18446744073709551615]
|
||||
|
@ -3,4 +3,4 @@ RUN: not llvm-profdata show %t 2>&1 | FileCheck %s
|
||||
RUN: printf '\377lprofr\201' > %t
|
||||
RUN: not llvm-profdata show %t 2>&1 | FileCheck %s
|
||||
|
||||
CHECK: error: {{.+}}: Invalid instrumentation profile data (file header is corrupt)
|
||||
CHECK: error: {{.+}}: invalid instrumentation profile data (file header is corrupt)
|
||||
|
@ -16,6 +16,4 @@ RUN: diff %t-basic.dump3 %t-basic.dump4
|
||||
RUN: diff %t-basic.proftext5 %t-basic.proftext6
|
||||
|
||||
RUN: not llvm-profdata merge -gcc -o %t-basic-profdata3 %t-basic.proftext2 2>&1 | FileCheck %s --check-prefix=UNKNOWN
|
||||
UNKNOWN: Unknown
|
||||
|
||||
|
||||
UNKNOWN: unknown format is specified
|
||||
|
@ -2,36 +2,36 @@ Tests for instrumentation profile bad encoding.
|
||||
|
||||
1- Detect invalid count
|
||||
RUN: not llvm-profdata show %p/Inputs/invalid-count-later.proftext 2>&1 | FileCheck %s --check-prefix=INVALID-COUNT-LATER-SHOW
|
||||
INVALID-COUNT-LATER-SHOW: error: {{.*}}invalid-count-later.proftext: Malformed instrumentation profile data
|
||||
INVALID-COUNT-LATER-SHOW: error: {{.*}}invalid-count-later.proftext: malformed instrumentation profile data
|
||||
|
||||
RUN: not llvm-profdata merge %p/Inputs/invalid-count-later.proftext %p/Inputs/invalid-count-later.proftext -o %t.out 2>&1 | FileCheck %s --check-prefix=INVALID-COUNT-LATER-MERGE
|
||||
RUN: not llvm-profdata merge -failure-mode=all %p/Inputs/invalid-count-later.proftext %p/Inputs/invalid-count-later.proftext -o %t.out 2>&1 | FileCheck %s --check-prefix=INVALID-COUNT-LATER-MERGE
|
||||
INVALID-COUNT-LATER-MERGE: warning: {{.*}}invalid-count-later.proftext: Malformed instrumentation profile data
|
||||
INVALID-COUNT-LATER-MERGE-NEXT: warning: {{.*}}invalid-count-later.proftext: Malformed instrumentation profile data
|
||||
INVALID-COUNT-LATER-MERGE-NEXT: error: No profiles could be merged.
|
||||
INVALID-COUNT-LATER-MERGE: warning: {{.*}}invalid-count-later.proftext: malformed instrumentation profile data
|
||||
INVALID-COUNT-LATER-MERGE-NEXT: warning: {{.*}}invalid-count-later.proftext: malformed instrumentation profile data
|
||||
INVALID-COUNT-LATER-MERGE-NEXT: error: no profile can be merged
|
||||
|
||||
2- Detect bad hash
|
||||
RUN: not llvm-profdata show %p/Inputs/bad-hash.proftext 2>&1 | FileCheck %s --check-prefix=BAD-HASH-SHOW
|
||||
BAD-HASH-SHOW: error: {{.*}}bad-hash.proftext: Malformed instrumentation profile data
|
||||
BAD-HASH-SHOW: error: {{.*}}bad-hash.proftext: malformed instrumentation profile data
|
||||
|
||||
RUN: not llvm-profdata merge %p/Inputs/bad-hash.proftext %p/Inputs/bad-hash.proftext -o %t.out 2>&1 | FileCheck %s --check-prefix=BAD-HASH-MERGE
|
||||
BAD-HASH-MERGE: warning: {{.*}}bad-hash.proftext: Malformed instrumentation profile data
|
||||
BAD-HASH-NEXT: error: No profiles could be merged.
|
||||
BAD-HASH-MERGE: warning: {{.*}}bad-hash.proftext: malformed instrumentation profile data
|
||||
BAD-HASH-NEXT: error: no profiles can be merged
|
||||
|
||||
3- Detect no counts
|
||||
RUN: not llvm-profdata show %p/Inputs/no-counts.proftext 2>&1 | FileCheck %s --check-prefix=NO-COUNTS
|
||||
NO-COUNTS: error: {{.*}}no-counts.proftext: Malformed instrumentation profile data
|
||||
NO-COUNTS: error: {{.*}}no-counts.proftext: malformed instrumentation profile data
|
||||
|
||||
4- Detect binary input
|
||||
RUN: not llvm-profdata show %p/Inputs/text-format-errors.text.bin 2>&1 | FileCheck %s --check-prefix=BINARY
|
||||
BINARY: error: {{.+}}: Unrecognized instrumentation profile encoding format
|
||||
BINARY: error: {{.+}}: unrecognized instrumentation profile encoding format
|
||||
BINARY: Perhaps you forgot to use the --sample option?
|
||||
|
||||
5- Detect malformed value profile data
|
||||
RUN: not llvm-profdata show %p/Inputs/vp-malform.proftext 2>&1 | FileCheck %s --check-prefix=VP
|
||||
RUN: not llvm-profdata show %p/Inputs/vp-malform2.proftext 2>&1 | FileCheck %s --check-prefix=VP
|
||||
VP: Malformed instrumentation profile data
|
||||
VP: error: {{.+}}: malformed instrumentation profile data
|
||||
|
||||
6- Detect truncated value profile data
|
||||
RUN: not llvm-profdata show %p/Inputs/vp-truncate.proftext 2>&1 | FileCheck %s --check-prefix=VPTRUNC
|
||||
VPTRUNC: Truncated profile data
|
||||
VPTRUNC: error: {{.+}}: truncated profile data
|
||||
|
@ -7,4 +7,4 @@ RUN: %S/Inputs/counter-mismatch-3.proftext \
|
||||
RUN: %S/Inputs/counter-mismatch-4.proftext \
|
||||
RUN: 2>&1 | FileCheck %s
|
||||
|
||||
CHECK: Function basic block count change detected (counter mismatch)
|
||||
CHECK: {{.+}}: foo: function basic block count change detected (counter mismatch)
|
||||
|
@ -70,7 +70,7 @@ RUN: not llvm-profdata merge -instr -weighted-input=3,%p/Inputs/weight-instr-bar
|
||||
RUN: not llvm-profdata merge -instr -weighted-input=3,%p/Inputs/weight-instr-bar.profdata -weighted-input=-5,%p/Inputs/weight-instr-foo.profdata -o %t.out 2>&1 | FileCheck %s -check-prefix=INVALID_WEIGHT
|
||||
RUN: not llvm-profdata merge -instr -weighted-input=3,%p/Inputs/weight-instr-bar.profdata -weighted-input=,%p/Inputs/weight-instr-foo.profdata -o %t.out 2>&1 | FileCheck %s -check-prefix=INVALID_WEIGHT
|
||||
RUN: not llvm-profdata merge -instr -weighted-input=3,%p/Inputs/weight-instr-bar.profdata -weighted-input=%p/Inputs/weight-instr-foo.profdata -o %t.out 2>&1 | FileCheck %s -check-prefix=INVALID_WEIGHT
|
||||
INVALID_WEIGHT: error: Input weight must be a positive integer.
|
||||
INVALID_WEIGHT: error: input weight must be a positive integer
|
||||
|
||||
4- Bad merge: input path does not exist
|
||||
RUN: not llvm-profdata merge -instr -weighted-input=3,%p/Inputs/does-not-exist.profdata -weighted-input=2,%p/Inputs/does-not-exist-either.profdata -o %t.out 2>&1 | FileCheck -DMSG=%errc_ENOENT %s -check-prefix=INVALID_INPUT
|
||||
@ -78,4 +78,4 @@ INVALID_INPUT: {{.*}}: {{.*}}does-not-exist.profdata: [[MSG]]
|
||||
|
||||
5- No inputs
|
||||
RUN: not llvm-profdata merge -instr -o %t.out 2>&1 | FileCheck %s -check-prefix=NO_INPUT
|
||||
NO_INPUT: {{.*}}: No input files specified. See llvm-profdata{{(\.EXE|\.exe)?}} merge -help
|
||||
NO_INPUT: error: no input files specified. See llvm-profdata{{(\.EXE|\.exe)?}} merge -help
|
||||
|
@ -45,7 +45,7 @@ RUN: not llvm-profdata merge -sample -weighted-input=3,%p/Inputs/weight-sample-b
|
||||
RUN: not llvm-profdata merge -sample -weighted-input=3,%p/Inputs/weight-sample-bar.proftext -weighted-input=-5,%p/Inputs/weight-sample-foo.proftext -o %t.out 2>&1 | FileCheck %s -check-prefix=INVALID_WEIGHT
|
||||
RUN: not llvm-profdata merge -sample -weighted-input=3,%p/Inputs/weight-sample-bar.proftext -weighted-input=,%p/Inputs/weight-sample-foo.proftext -o %t.out 2>&1 | FileCheck %s -check-prefix=INVALID_WEIGHT
|
||||
RUN: not llvm-profdata merge -sample -weighted-input=3,%p/Inputs/weight-sample-bar.proftext -weighted-input=%p/Inputs/weight-sample-foo.proftext -o %t.out 2>&1 | FileCheck %s -check-prefix=INVALID_WEIGHT
|
||||
INVALID_WEIGHT: error: Input weight must be a positive integer.
|
||||
INVALID_WEIGHT: error: input weight must be a positive integer
|
||||
|
||||
4- Bad merge: input path does not exist
|
||||
RUN: not llvm-profdata merge -sample -weighted-input=3,%p/Inputs/does-not-exist.proftext -weighted-input=2,%p/Inputs/does-not-exist-either.proftext -o %t.out 2>&1 | FileCheck -DMSG=%errc_ENOENT %s -check-prefix=INVALID_INPUT
|
||||
@ -53,4 +53,4 @@ INVALID_INPUT: {{.*}}: {{.*}}does-not-exist.proftext: [[MSG]]
|
||||
|
||||
5- No inputs
|
||||
RUN: not llvm-profdata merge -sample -o %t.out 2>&1 | FileCheck %s -check-prefix=NO_INPUT
|
||||
NO_INPUT: {{.*}}: No input files specified. See llvm-profdata{{(\.EXE|\.exe)?}} merge -help
|
||||
NO_INPUT: {{.*}}: no input files specified. See llvm-profdata{{(\.EXE|\.exe)?}} merge -help
|
||||
|
@ -327,11 +327,11 @@ static void mergeInstrProfile(const WeightedFileVector &Inputs,
|
||||
ProfileFormat OutputFormat, bool OutputSparse,
|
||||
unsigned NumThreads, FailureMode FailMode) {
|
||||
if (OutputFilename.compare("-") == 0)
|
||||
exitWithError("Cannot write indexed profdata format to stdout.");
|
||||
exitWithError("cannot write indexed profdata format to stdout");
|
||||
|
||||
if (OutputFormat != PF_Binary && OutputFormat != PF_Compact_Binary &&
|
||||
OutputFormat != PF_Ext_Binary && OutputFormat != PF_Text)
|
||||
exitWithError("Unknown format is specified.");
|
||||
exitWithError("unknown format is specified");
|
||||
|
||||
std::mutex ErrorLock;
|
||||
SmallSet<instrprof_error, 4> WriterErrorCodes;
|
||||
@ -394,7 +394,7 @@ static void mergeInstrProfile(const WeightedFileVector &Inputs,
|
||||
}
|
||||
if (NumErrors == Inputs.size() ||
|
||||
(NumErrors > 0 && FailMode == failIfAnyAreInvalid))
|
||||
exitWithError("No profiles could be merged.");
|
||||
exitWithError("no profile can be merged");
|
||||
|
||||
writeInstrProfile(OutputFilename, OutputFormat, Contexts[0]->Writer);
|
||||
}
|
||||
@ -552,11 +552,11 @@ static void supplementInstrProfile(
|
||||
unsigned SupplMinSizeThreshold, float ZeroCounterThreshold,
|
||||
unsigned InstrProfColdThreshold) {
|
||||
if (OutputFilename.compare("-") == 0)
|
||||
exitWithError("Cannot write indexed profdata format to stdout.");
|
||||
exitWithError("cannot write indexed profdata format to stdout");
|
||||
if (Inputs.size() != 1)
|
||||
exitWithError("Expect one input to be an instr profile.");
|
||||
exitWithError("expect one input to be an instr profile");
|
||||
if (Inputs[0].Weight != 1)
|
||||
exitWithError("Expect instr profile doesn't have weight.");
|
||||
exitWithError("expect instr profile doesn't have weight");
|
||||
|
||||
StringRef InstrFilename = Inputs[0].Filename;
|
||||
|
||||
@ -784,7 +784,7 @@ static WeightedFile parseWeightedFile(const StringRef &WeightedFilename) {
|
||||
|
||||
uint64_t Weight;
|
||||
if (WeightStr.getAsInteger(10, Weight) || Weight < 1)
|
||||
exitWithError("Input weight must be a positive integer.");
|
||||
exitWithError("input weight must be a positive integer");
|
||||
|
||||
return {std::string(FileName), Weight};
|
||||
}
|
||||
@ -958,7 +958,7 @@ static int merge_main(int argc, const char *argv[]) {
|
||||
parseInputFilenamesFile(Buffer.get(), WeightedInputs);
|
||||
|
||||
if (WeightedInputs.empty())
|
||||
exitWithError("No input files specified. See " +
|
||||
exitWithError("no input files specified. See " +
|
||||
sys::path::filename(argv[0]) + " -help");
|
||||
|
||||
if (DumpInputFileList) {
|
||||
@ -1007,7 +1007,7 @@ static void overlapInstrProfile(const std::string &BaseFilename,
|
||||
OverlapStats Overlap;
|
||||
Error E = Overlap.accumulateCounts(BaseFilename, TestFilename, IsCS);
|
||||
if (E)
|
||||
exitWithError(std::move(E), "Error in getting profile count sums");
|
||||
exitWithError(std::move(E), "error in getting profile count sums");
|
||||
if (Overlap.Base.CountSum < 1.0f) {
|
||||
OS << "Sum of edge counts for profile " << BaseFilename << " is 0.\n";
|
||||
exit(0);
|
||||
|
Loading…
Reference in New Issue
Block a user