Skip to content

Commit b707e80

Browse files
committed
Add usePseudoProbes() guard and comments
1 parent c53e0ae commit b707e80

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

llvm/tools/llvm-profgen/ProfileGenerator.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -735,9 +735,13 @@ ProfileGeneratorBase::getCalleeNameForAddress(uint64_t TargetAddress) {
735735
if (!FRange || !FRange->IsFuncEntry)
736736
return StringRef();
737737

738-
auto FuncName = Binary->findPseudoProbeName(FRange->Func);
739-
if (FuncName.size())
740-
return FunctionSamples::getCanonicalFnName(FuncName);
738+
// DWARF and symbol table may have mismatching function names. Instead, we'll
739+
// try to use its pseudo probe name first.
740+
if (Binary->usePseudoProbes()) {
741+
auto FuncName = Binary->findPseudoProbeName(FRange->Func);
742+
if (FuncName.size())
743+
return FunctionSamples::getCanonicalFnName(FuncName);
744+
}
741745

742746
return FunctionSamples::getCanonicalFnName(FRange->getFuncName());
743747
}

0 commit comments

Comments
 (0)