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

Alok Kumar Sharma via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 14 07:16:13 PDT 2026


================
@@ -327,8 +349,17 @@ bool MergeFunctionsPass::runOnModule(Module &M) {
 }
 
 DenseMap<Function *, Function *>
-MergeFunctionsPass::runOnFunctions(ArrayRef<Function *> F) {
-  MergeFunctions MF;
+MergeFunctionsPass::runOnFunctions(ArrayRef<Function *> F,
+                                   ModuleAnalysisManager &AM) {
+  if (F.empty())
+    return DenseMap<Function *, Function *>();
+
+  Module &M = *F.front()->getParent();
+  assert(
----------------
alokkrsharma wrote:

Agreed, will remove the same-module assertion since the pipeline compiles a single translation unit throughout.

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


More information about the llvm-commits mailing list