This commit introduces the function_entry_count metadata field to the
LLVMFuncOp and adds both the corresponding import and export
funtionalities.
The import of the function metadata uses the same infrastructure as the
instruction metadata, i.e., it dispatches through a dialect interface.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp | ||
---|---|---|
1996 | nit: functionEntryCounts -> functionEntryCount | |
2010 | I think there is a getFunctionEntryCountAttrName name? Also should't this be singular without an s? | |
mlir/lib/Target/LLVMIR/Dialect/LLVMIR/LLVMIRToLLVMTranslation.cpp | ||
87 | nit: the comment needs an update. | |
92 | Should we use the attribute name here and below? | |
93–94 | nit: "TODO support function entry count metadata with a global identifier field." That way it is clear there is no specific reason why this is not imported. | |
mlir/lib/Target/LLVMIR/ModuleImport.cpp | ||
1191–1200 | Any chance this could be factored out in a helper method assuming instructions and functions are both values? | |
mlir/lib/Target/LLVMIR/ModuleTranslation.cpp | ||
893 | nit: auto -> Int64Attr? |
mlir/lib/Target/LLVMIR/Dialect/LLVMIR/LLVMIRToLLVMTranslation.cpp | ||
---|---|---|
92 | I do not quite follow. This function does not belong to a specific operation, so one has no access to the attribute name accessors | |
93–94 | I'm not sure if these GUIDs would be preserved when exporting back to LLVM. But I can add it as a TODO and we can later on check if this is indeed the case or not. | |
mlir/lib/Target/LLVMIR/ModuleImport.cpp | ||
1191–1200 | I tired, but unfortunately Value::getAllMetadata is protected and cannot be accessed. Furthermore, llvm::Value has no location, so such a function would take up to 4 arguments. |
nit: functionEntryCounts -> functionEntryCount