[llvm] [BOLT] Introduce BinaryFunction::canClone() (PR #138771)

Paschalis Mpeis via llvm-commits llvm-commits at lists.llvm.org
Wed May 7 02:22:48 PDT 2025


================
@@ -3744,6 +3744,16 @@ void BinaryFunction::postProcessBranches() {
   assert(validateCFG() && "invalid CFG");
 }
 
+bool BinaryFunction::canClone() const {
+  // For instrumentation, we need to restrict the execution to the rewritten
+  // version of the function.
+  if (opts::Instrument)
+    return false;
+
+  // Check for the presence of metadata that cannot be duplicated.
+  return !hasEHRanges() && !hasSDTMarker() && !hasPseudoProbe() && !hasORC();
----------------
paschalis-mpeis wrote:

Note that I'm missing the practical details here.

What happens if we clone the pseudo-probes as well? Since they are uuids for blocks, would the cloned blocks also be identified as the original ones?

And if we don't clone them, are users expected to rely on pseudo-probes after a binary has been bolted?

https://github.com/llvm/llvm-project/pull/138771


More information about the llvm-commits mailing list