Skip to content

Commit

Permalink
[Pseudo Probe] Remove the assert of allowing only one call probe for …
Browse files Browse the repository at this point in the history
…a callsite.

Compiler-generated static symbols, such as the global initializers, can shared the same name and can coexist in the binary. As a result, their pseudo probes are all kept in the binary too. This could cause multiple call probes decoded against one callsite, as probes are decoded against there owning functions by name. I'm temporarily disabling an assert to keep the debug build green until we have a better fix.

Reviewed By: wenlei

Differential Revision: https://reviews.llvm.org/D153588
  • Loading branch information
htyu committed Jun 23, 2023
1 parent 7ba9506 commit abe34ce
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions llvm/lib/MC/MCPseudoProbe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -584,10 +584,20 @@ MCPseudoProbeDecoder::getCallProbeForAddr(uint64_t Address) const {
const MCDecodedPseudoProbe *CallProbe = nullptr;
for (const auto &Probe : Probes) {
if (Probe.isCall()) {
assert(!CallProbe &&
"There should be only one call probe corresponding to address "
"which is a callsite.");
// Disabling the assert and returning first call probe seen so far.
// Subsequent call probes, if any, are ignored. Due to the the way
// .pseudo_probe section is decoded, probes of the same-named independent
// static functions are merged thus multiple call probes may be seen for a
// callsite. This should only happen to compiler-generated statics, with
// -funique-internal-linkage-names where user statics get unique names.
//
// TODO: re-enable or narrow down the assert to static functions only.
//
// assert(!CallProbe &&
// "There should be only one call probe corresponding to address "
// "which is a callsite.");
CallProbe = &Probe;
break;
}
}
return CallProbe;
Expand Down

0 comments on commit abe34ce

Please sign in to comment.