[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;
+ for (const llvm::MDOperand &operand : mdTuple->operands()) {
+ auto *mdString = dyn_cast<llvm::MDString>(operand);
----------------
erichkeane wrote:
Are operands guaranteed non-null? Should this be `dyn_cast_if_present`?
https://github.com/llvm/llvm-project/pull/188741
More information about the Mlir-commits
mailing list