[llvm] abe34ce - [Pseudo Probe] Remove the assert of allowing only one call probe for a callsite.

Hongtao Yu via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 23 16:41:23 PDT 2023


Author: Hongtao Yu
Date: 2023-06-23T16:41:14-07:00
New Revision: abe34ce4e3ba460743150dea7c8d557cd6ba6eb0

URL: https://github.com/llvm/llvm-project/commit/abe34ce4e3ba460743150dea7c8d557cd6ba6eb0
DIFF: https://github.com/llvm/llvm-project/commit/abe34ce4e3ba460743150dea7c8d557cd6ba6eb0.diff

LOG: [Pseudo Probe] Remove the assert of allowing only one call probe for 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

Added: 
    

Modified: 
    llvm/lib/MC/MCPseudoProbe.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/MC/MCPseudoProbe.cpp b/llvm/lib/MC/MCPseudoProbe.cpp
index 35eafec721695..caec98e9ea6ab 100644
--- a/llvm/lib/MC/MCPseudoProbe.cpp
+++ b/llvm/lib/MC/MCPseudoProbe.cpp
@@ -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;


        


More information about the llvm-commits mailing list