[llvm] [MergeFunctions] Preserve instruction-level profile metadata during merging (PR #208009)

Alok Kumar Sharma via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 9 23:58:13 PDT 2026


================
@@ -28,9 +28,11 @@ class MergeFunctionsPass : public OptionalPassInfoMixin<MergeFunctionsPass> {
 public:
   LLVM_ABI PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
 
-  LLVM_ABI static bool runOnModule(Module &M);
+  LLVM_ABI static bool runOnModule(Module &M,
+                                   FunctionAnalysisManager *FAM = nullptr);
----------------
alokkrsharma wrote:

Yes — MergeFunctionsTest.cpp calls runOnModule(*M) and runOnFunctions(...) without FAM in all four tests. I kept the optional default to avoid changing that API surface in this patch.

In the next revision, when FAM is null we'll fall back to entry-count scaling for profile merge. The NewPM path will still always pass FAM. I'll also add a comment in the header to make that explicit.

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


More information about the llvm-commits mailing list