[Mlir-commits] [mlir] [MLIR][LLVMIR] Add module flags support (PR #130679)
Tobias Gysi
llvmlistbot at llvm.org
Fri Mar 14 00:55:56 PDT 2025
================
@@ -517,6 +517,38 @@ void ModuleImport::addDebugIntrinsic(llvm::CallInst *intrinsic) {
debugIntrinsics.insert(intrinsic);
}
+LogicalResult ModuleImport::convertModuleFlagsMetadata() {
+ SmallVector<llvm::Module::ModuleFlagEntry, 4> llvmModuleFlags;
+ for (const llvm::NamedMDNode &named : llvmModule->named_metadata()) {
+ if (named.getName() != LLVMDialect::getModuleFlags())
+ continue;
+ llvmModule->getModuleFlagsMetadata(llvmModuleFlags);
----------------
gysit wrote:
Are you sure the loop is needed?
Couldn't we just call `llvmModule->getModuleFlagsMetadata(llvmModuleFlags);` and then check if llvmModuleFlags is empty afterwards? Or would this function fail if there is no module flag metadata?
https://github.com/llvm/llvm-project/pull/130679
More information about the Mlir-commits
mailing list