Issue 202374
Summary [MLIR][LLVM] import drops valid function-level `!prof` metadata
Labels mlir:llvm, mlir
Assignees
Reporter Men-cotton
    Reproducer

```llvm
define void @synthetic() !prof !0 {
  ret void
}

!0 = !{!"synthetic_function_entry_count", i64 7}
```

```llvm
define void @with_import_guid() !prof !0 {
  ret void
}

!0 = !{!"function_entry_count", i64 7, i64 1234}
```

```bash
llvm-as -disable-output repro.ll
mlir-translate -import-llvm repro.ll
mlir-translate -import-llvm repro.ll | mlir-translate -mlir-to-llvmir
```

---

While `llvm-as -disable-output` accepts both inputs, MLIR's LLVM IR importer fails to preserve them. Importing them with `mlir-translate -import-llvm` emits:

```text
warning: unhandled function metadata: !0 = !{!"synthetic_function_entry_count", i64 7} on define void @synthetic() !prof !0
warning: unhandled function metadata: !0 = !{!"function_entry_count", i64 7, i64 1234} on define void @with_import_guid() !prof !0
```

The resulting MLIR contains no representation of the `!prof` attachments, meaning they are completely dropped when exporting back to LLVM IR.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to