@@ -530,28 +530,20 @@ LogicalResult ModuleImport::convertModuleFlagsMetadata() {
530530 for (const auto [behavior, key, val] : llvmModuleFlags) {
531531 // Currently only supports most common: int constant values.
532532 auto *constInt = llvm::mdconst::dyn_extract<llvm::ConstantInt>(val);
533- if (!constInt) {
533+ if (!constInt)
534534 return emitWarning (mlirModule.getLoc ())
535535 << " unsupported module flag value: "
536536 << diagMD (val, llvmModule.get ())
537537 << " , only constant integer currently supported" ;
538- }
539- // auto valAttr = builder.getIntegerAttr(
540- // IntegerType::get(context, constInt->getType()->getIntegerBitWidth()),
541- // constInt->getValue());
542-
543- // ModFlagBehaviorAttr behaviorAttr = ModFlagBehaviorAttr::get(
544- // builder.getContext(), (ModFlagBehavior)behavior);
545538
546539 moduleFlags.push_back (builder.getAttr <ModuleFlagAttr>(
547- (ModFlagBehavior) behavior, builder. getStringAttr (key-> getString () ),
548- constInt->getZExtValue ()));
540+ convertModFlagBehaviorFromLLVM ( behavior),
541+ builder. getStringAttr (key-> getString ()), constInt->getZExtValue ()));
549542 }
550543
551- if (!moduleFlags.empty ()) {
544+ if (!moduleFlags.empty ())
552545 builder.create <LLVM::ModuleFlagsOp>(mlirModule.getLoc (),
553546 builder.getArrayAttr (moduleFlags));
554- }
555547
556548 return success ();
557549}
0 commit comments