[llvm] [llvm-profgen] Loading binary functions from .symtab when DWARF info is incomplete (PR #163654)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 15 15:58:06 PDT 2025
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff origin/main HEAD --extensions h,cpp -- llvm/include/llvm/ProfileData/SampleProf.h llvm/tools/llvm-profgen/ProfileGenerator.cpp llvm/tools/llvm-profgen/ProfiledBinary.cpp llvm/tools/llvm-profgen/ProfiledBinary.h --diff_from_common_commit
``````````
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/llvm/include/llvm/ProfileData/SampleProf.h b/llvm/include/llvm/ProfileData/SampleProf.h
index 4adbe13b6..dadf718d0 100644
--- a/llvm/include/llvm/ProfileData/SampleProf.h
+++ b/llvm/include/llvm/ProfileData/SampleProf.h
@@ -1214,7 +1214,7 @@ public:
// Note the sequence of the suffixes in the knownSuffixes array matters.
// If suffix "A" is appended after the suffix "B", "A" should be in front
// of "B" in knownSuffixes.
- SmallVector<StringRef> KnownSuffixes ({LLVMSuffix, PartSuffix, UniqSuffix});
+ SmallVector<StringRef> KnownSuffixes({LLVMSuffix, PartSuffix, UniqSuffix});
return getCanonicalFnName(FnName, KnownSuffixes, Attr);
}
diff --git a/llvm/tools/llvm-profgen/ProfileGenerator.cpp b/llvm/tools/llvm-profgen/ProfileGenerator.cpp
index 058b154fc..0478d5568 100644
--- a/llvm/tools/llvm-profgen/ProfileGenerator.cpp
+++ b/llvm/tools/llvm-profgen/ProfileGenerator.cpp
@@ -492,13 +492,18 @@ bool ProfileGeneratorBase::collectFunctionsFromRawProfile(
}
if (ErrStkAddr)
- WithColor::warning() << "Cannot find Stack Address from DWARF Info: " << ErrStkAddr << "/" << TotalStkAddr << " missing\n";
+ WithColor::warning() << "Cannot find Stack Address from DWARF Info: "
+ << ErrStkAddr << "/" << TotalStkAddr << " missing\n";
if (ErrFuncRange)
- WithColor::warning() << "Cannot find Function Range from DWARF Info: " << ErrFuncRange << "/" << TotalFuncRange << " missing\n";
+ WithColor::warning() << "Cannot find Function Range from DWARF Info: "
+ << ErrFuncRange << "/" << TotalFuncRange
+ << " missing\n";
if (ErrSrc)
- WithColor::warning() << "Cannot find LBR Source Addr from DWARF Info: " << ErrSrc << "/" << TotalSrc << " missing\n";
+ WithColor::warning() << "Cannot find LBR Source Addr from DWARF Info: "
+ << ErrSrc << "/" << TotalSrc << " missing\n";
if (ErrTgt)
- WithColor::warning() << "Cannot find LBR Target Addr from DWARF Info: " << ErrTgt << "/" << TotalTgt << " missing\n";
+ WithColor::warning() << "Cannot find LBR Target Addr from DWARF Info: "
+ << ErrTgt << "/" << TotalTgt << " missing\n";
return true;
}
diff --git a/llvm/tools/llvm-profgen/ProfiledBinary.cpp b/llvm/tools/llvm-profgen/ProfiledBinary.cpp
index 2d9a13b97..aa385c0db 100644
--- a/llvm/tools/llvm-profgen/ProfiledBinary.cpp
+++ b/llvm/tools/llvm-profgen/ProfiledBinary.cpp
@@ -822,8 +822,7 @@ void ProfiledBinary::populateSymbolAddressList(const ObjectFile *Obj) {
}
}
-void ProfiledBinary::populateSymbolsFromElf(
- const ObjectFile *Obj) {
+void ProfiledBinary::populateSymbolsFromElf(const ObjectFile *Obj) {
// Load binary functions from ELF symbol table when DWARF info is incomplete
StringRef FileName = Obj->getFileName();
for (const ELFSymbolRef Symbol : Obj->symbols()) {
@@ -836,8 +835,9 @@ void ProfiledBinary::populateSymbolsFromElf(
continue;
SmallVector<StringRef> Suffixes(
- {".destroy", ".resume", ".llvm.", ".cold", ".warm"});
- const StringRef SymName = FunctionSamples::getCanonicalFnName(Name, Suffixes);
+ {".destroy", ".resume", ".llvm.", ".cold", ".warm"});
+ const StringRef SymName =
+ FunctionSamples::getCanonicalFnName(Name, Suffixes);
auto Ret = BinaryFunctions.emplace(SymName, BinaryFunction());
auto &Func = Ret.first->second;
``````````
</details>
https://github.com/llvm/llvm-project/pull/163654
More information about the llvm-commits
mailing list