[llvm] [BOLT] Introduce BinaryFunction::canClone() (PR #138771)
Maksim Panchenko via llvm-commits
llvm-commits at lists.llvm.org
Tue May 6 21:52:41 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();
----------------
maksfb wrote:
I expect only tiny leaf function to be cloned, everything else should be patched.
https://github.com/llvm/llvm-project/pull/138771
More information about the llvm-commits
mailing list