Skip to content

Commit 75dc996

Browse files
committed
Nit
1 parent 0dc2c66 commit 75dc996

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

llvm/include/llvm/ProfileData/SampleProf.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1214,18 +1214,19 @@ class FunctionSamples {
12141214
// Note the sequence of the suffixes in the knownSuffixes array matters.
12151215
// If suffix "A" is appended after the suffix "B", "A" should be in front
12161216
// of "B" in knownSuffixes.
1217-
const char *KnownSuffixes[] = {LLVMSuffix, PartSuffix, UniqSuffix, nullptr};
1217+
const SmallVector<StringRef> KnownSuffixes{LLVMSuffix, PartSuffix,
1218+
UniqSuffix};
12181219
return getCanonicalFnName(FnName, KnownSuffixes, Attr);
12191220
}
12201221

1221-
static StringRef getCanonicalFnName(StringRef FnName, const char *Suffixes[],
1222+
static StringRef getCanonicalFnName(StringRef FnName,
1223+
ArrayRef<StringRef> Suffixes,
12221224
StringRef Attr = "selected") {
12231225
if (Attr == "" || Attr == "all")
12241226
return FnName.split('.').first;
12251227
if (Attr == "selected") {
12261228
StringRef Cand(FnName);
1227-
for (const char **Suf = Suffixes; *Suf; Suf++) {
1228-
StringRef Suffix(*Suf);
1229+
for (const auto Suffix : Suffixes) {
12291230
// If the profile contains ".__uniq." suffix, don't strip the
12301231
// suffix for names in the IR.
12311232
if (Suffix == UniqSuffix && FunctionSamples::HasUniqSuffix)

llvm/test/tools/llvm-profgen/missing-dwarf.test

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,16 @@
33
; RUN: cd %t
44

55
; RUN: echo -e "1\n401120-40113b:1\n1\n40112f->401110:1" > %t.prof
6-
; RUN: cp %S/Inputs/missing-dwarf.exe %t/missing-dwarf.exe
76

87
; Test --load-function-from-symbol=0
9-
; RUN: llvm-profgen --format=text --unsymbolized-profile=%t.prof --binary=%t/missing-dwarf.exe --output=%t1 --fill-zero-for-all-funcs --show-detailed-warning --use-offset=0 --load-function-from-symbol=0 2>&1 | FileCheck %s --check-prefix=CHECK-NO-LOAD-SYMTAB
8+
; RUN: llvm-profgen --format=text --unsymbolized-profile=%t.prof --binary=%S/Inputs/missing-dwarf.exe --output=%t1 --fill-zero-for-all-funcs --show-detailed-warning --use-offset=0 --load-function-from-symbol=0 2>&1 | FileCheck %s --check-prefix=CHECK-NO-LOAD-SYMTAB
109

1110
; CHECK-NO-LOAD-SYMTAB: warning: 100.00%(1/1) of function range samples do not belong to any function
1211
; CHECK-NO-LOAD-SYMTAB-NEXT: warning: 100.00%(1/1) of LBR source samples do not belong to any function
1312
; CHECK-NO-LOAD-SYMTAB-NEXT: warning: 100.00%(1/1) of LBR target samples do not belong to any function
1413

1514
; Test --load-function-from-symbol=1
16-
; RUN: llvm-profgen --format=text --unsymbolized-profile=%t.prof --binary=%t/missing-dwarf.exe --output=%t2 --fill-zero-for-all-funcs --show-detailed-warning --use-offset=0 --load-function-from-symbol=1
15+
; RUN: llvm-profgen --format=text --unsymbolized-profile=%t.prof --binary=%S/Inputs/missing-dwarf.exe --output=%t2 --fill-zero-for-all-funcs --show-detailed-warning --use-offset=0 --load-function-from-symbol=1
1716
; RUN: FileCheck %s --input-file %t2 --check-prefix=CHECK-LOAD-SYMTAB
1817

1918
; CHECK-LOAD-SYMTAB: main:2:1

llvm/tools/llvm-profgen/ProfiledBinary.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -832,8 +832,8 @@ void ProfiledBinary::populateSymbolAddressList(const ObjectFile *Obj) {
832832

833833
void ProfiledBinary::populateSymbolsFromBinary(const ObjectFile *Obj) {
834834
// Load binary functions from symbol table when Debug info is incomplete
835-
const char *Suffixes[] = {".destroy", ".resume", ".llvm.",
836-
".cold", ".warm", nullptr};
835+
const SmallVector<StringRef> Suffixes(
836+
{".destroy", ".resume", ".llvm.", ".cold", ".warm"});
837837
StringRef FileName = Obj->getFileName();
838838
for (const SymbolRef &Symbol : Obj->symbols()) {
839839
const SymbolRef::Type Type = unwrapOrError(Symbol.getType(), FileName);

0 commit comments

Comments
 (0)