[Mlir-commits] [mlir] [MLIR][LLVMIR] Handle MDTuple-of-MDStrings module flags (e.g. riscv-isa) (PR #188741)

Erich Keane llvmlistbot at llvm.org
Wed Apr 1 06:37:57 PDT 2026


================
@@ -841,7 +841,17 @@ convertModuleFlagValueFromMDTuple(ModuleOp mlirModule,
   if (key == LLVMDialect::getModuleFlagKeyProfileSummaryName())
     return convertProfileSummaryModuleFlagValue(mlirModule, llvmModule,
                                                 mdTuple);
-  return nullptr;
+  // Handle MDTuples whose operands are all MDStrings (e.g. "riscv-isa").
+  // Convert them to ArrayAttr of StringAttrs for a lossless round-trip.
+  Builder builder(mlirModule->getContext());
+  SmallVector<Attribute> strings;
----------------
erichkeane wrote:

Might suggest a `strings.reserve(mdTuple->operands().size())`.  Its a bit of an 'over-reserve', but will prevent a couple of allocations potentially.

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


More information about the Mlir-commits mailing list