diff --git a/flang/include/flang/Optimizer/Dialect/FIROps.td b/flang/include/flang/Optimizer/Dialect/FIROps.td --- a/flang/include/flang/Optimizer/Dialect/FIROps.td +++ b/flang/include/flang/Optimizer/Dialect/FIROps.td @@ -2768,11 +2768,6 @@ } static constexpr llvm::StringRef linkageAttrName() { return "linkName"; } - /// The printable type of the global - mlir::Type getType() { - return typeAttr().getValue(); - } - /// The semantic type of the global mlir::Type resultType(); diff --git a/flang/lib/Optimizer/Dialect/FIROps.cpp b/flang/lib/Optimizer/Dialect/FIROps.cpp --- a/flang/lib/Optimizer/Dialect/FIROps.cpp +++ b/flang/lib/Optimizer/Dialect/FIROps.cpp @@ -1229,7 +1229,7 @@ if (parser.parseColonType(globalType)) return mlir::failure(); - result.addAttribute(fir::GlobalOp::typeAttrName(result.name), + result.addAttribute(fir::GlobalOp::getTypeAttrName(result.name), mlir::TypeAttr::get(globalType)); if (simpleInitializer) { @@ -1273,7 +1273,7 @@ Attribute initialVal, StringAttr linkage, ArrayRef attrs) { result.addRegion(); - result.addAttribute(typeAttrName(result.name), mlir::TypeAttr::get(type)); + result.addAttribute(getTypeAttrName(result.name), mlir::TypeAttr::get(type)); result.addAttribute(mlir::SymbolTable::getSymbolAttrName(), builder.getStringAttr(name)); result.addAttribute(symbolAttrNameStr(), diff --git a/mlir/lib/TableGen/Operator.cpp b/mlir/lib/TableGen/Operator.cpp --- a/mlir/lib/TableGen/Operator.cpp +++ b/mlir/lib/TableGen/Operator.cpp @@ -701,8 +701,7 @@ // is safer). auto skip = [&](StringRef newName) { bool shouldSkip = newName == "getAttributeNames" || - newName == "getAttributes" || newName == "getOperation" || - newName == "getType"; + newName == "getAttributes" || newName == "getOperation"; if (newName == "getOperands") { // To reduce noise, skip generating the prefixed form and the warning if // $operands correspond to single variadic argument. @@ -715,6 +714,11 @@ return true; shouldSkip = true; } + if (newName == "getType") { + if (op.getNumResults() == 0) + return false; + shouldSkip = true; + } if (!shouldSkip) return false;