[llvm] [MemProf][PGO] Prevent dropping of profile metadata during optimization (PR #121359)
Teresa Johnson via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 2 09:46:10 PST 2025
================
@@ -347,3 +347,24 @@ template <> uint64_t CallStack<MDNode, MDNode::op_iterator>::back() const {
return mdconst::dyn_extract<ConstantInt>(N->operands().back())
->getZExtValue();
}
+
+MDNode *MDNode::getMergedMemProfMetadata(MDNode *A, MDNode *B) {
+ if (!(A && B)) {
+ return A ? A : B;
+ }
+
+ // TODO: Support more sophisticated merging, such as selecting the one with
+ // more bytes allocated, or implement support for carrying multiple allocation
+ // leaf contexts. For now, keep the first one.
+ return A;
----------------
teresajohnson wrote:
done
https://github.com/llvm/llvm-project/pull/121359
More information about the llvm-commits
mailing list