[llvm] [MemProf] Tolerate missing leaf debug frames (PR #71233)

Snehasish Kumar via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 3 15:13:31 PDT 2023


================
@@ -94,3 +94,34 @@ ${LLVMPROFDATA} merge --text ${OUTDIR}/memprof_pgo.profraw -o ${OUTDIR}/memprof_
 rm ${OUTDIR}/memprof.cc
 rm ${OUTDIR}/pgo.exe
 rm ${OUTDIR}/memprof_pgo.profraw
+
+# Use musttail to simulate a missing leaf debug frame in the profiled binary.
+# Note that changes in the code below which affect relative line number
+# offsets of calls from their parent function can affect callsite matching in
+# the LLVM IR.
+cat > ${OUTDIR}/memprof_missing_leaf.cc << EOF
+#include <new>
+#ifndef USE_MUSTTAIL
+#define USE_MUSTTAIL 0
+#endif
+
+// clang::musttail requires that the argument signature matches that of the caller.
+void *bar(std::size_t s) {
+#if USE_MUSTTAIL
+  [[clang::musttail]] return ::operator new (s);
+#else
+  return new char[s];
----------------
snehasish wrote:

Can we use the same "::operator new (s)" spelling here too? If not can you document why?

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


More information about the llvm-commits mailing list