[Mlir-commits] [mlir] [MLIR][LLVM] Add ProfileSummary module flag support (PR #138070)
Tobias Gysi
llvmlistbot at llvm.org
Thu May 1 01:15:42 PDT 2025
================
@@ -554,13 +554,262 @@ static Attribute convertCGProfileModuleFlagValue(ModuleOp mlirModule,
return ArrayAttr::get(mlirModule->getContext(), cgProfile);
}
+static Attribute
+convertProfileSummaryModuleFlagValue(ModuleOp mlirModule,
+ const llvm::Module *llvmModule,
+ llvm::MDTuple *mdTuple) {
+ unsigned profileNumEntries = mdTuple->getNumOperands();
+ if (profileNumEntries < 8) {
+ emitWarning(mlirModule.getLoc())
+ << "expected at 8 entries in 'ProfileSummary': "
+ << diagMD(mdTuple, llvmModule);
+ return nullptr;
+ }
+
+ unsigned summayIdx = 0;
+
+ auto getMDTuple = [&](const llvm::MDOperand &md) {
----------------
gysit wrote:
I wonder if it would make sense to make some of these helper lambdas static functions outside this function. I imagine we may be able to reuse some of them. Except they capturing is needed.
https://github.com/llvm/llvm-project/pull/138070
More information about the Mlir-commits
mailing list