[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 07:26:36 PST 2025


================
@@ -3379,6 +3379,10 @@ void llvm::combineMetadata(Instruction *K, const Instruction *J,
           K->setMetadata(Kind,
             MDNode::getMostGenericAlignmentOrDereferenceable(JMD, KMD));
         break;
+      case LLVMContext::MD_memprof:
+      case LLVMContext::MD_callsite:
+        // Preserve !memprof and !callsite metadata on K.
----------------
teresajohnson wrote:

It isn't incorrect to keep one. Since it is profile metadata, it doesn't affect correctness. We can improve how this is combined in the future, but simply keeping one set for now is a reasonable heuristic. 

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


More information about the llvm-commits mailing list