[Mlir-commits] [mlir] [mlir][llvm] Preserve function entry count metadata (PR #204707)
Tobias Gysi
llvmlistbot at llvm.org
Sun Jun 21 11:35:09 PDT 2026
================
@@ -2035,6 +2044,8 @@ def LLVM_LLVMFuncOp : LLVM_Op<"func", [
OptionalAttr<DictArrayAttr>:$arg_attrs,
OptionalAttr<DictArrayAttr>:$res_attrs,
OptionalAttr<I64Attr>:$function_entry_count,
+ UnitAttr:$function_entry_count_synthetic,
+ OptionalAttr<DenseI64ArrayAttr>:$function_entry_count_imports,
----------------
gysit wrote:
I would consider adding an entry count struct attribute that combines these three fields into a single struct attribute that could have the following fields:
LLVM_FunctionEntryCountAttr
- "uint64_t":entryCount
- "ProfileCountType":countType
- OptionalArrayRefParameter<"uint64_t">:imports
That way we we bundle all the entry count information into a single struct and some of the verification may not be necessary. The definition above assumes there is an mlir enum that matches the LLVM counterpart (ProfileCountType). See `AsmATTOrIntel` for an example on how to mirror an LLVM enum in MLIR. I am not sure if we also need an `ProfileCountTypeAttr` for the struct. Alternatively, we could also use a boolean parameter to mark synthetic entry counts but using the enum would be nicer.
https://github.com/llvm/llvm-project/pull/204707
More information about the Mlir-commits
mailing list