[Mlir-commits] [mlir] 402efa7 - [mlir][LLVM] Remove redundant `custom<LLVMOpAttrs>` (#116207)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Thu Nov 14 04:34:34 PST 2024
Author: Markus Böck
Date: 2024-11-14T13:34:31+01:00
New Revision: 402efa733c64bd20b54dbc5b7057868cbb938d07
URL: https://github.com/llvm/llvm-project/commit/402efa733c64bd20b54dbc5b7057868cbb938d07
DIFF: https://github.com/llvm/llvm-project/commit/402efa733c64bd20b54dbc5b7057868cbb938d07.diff
LOG: [mlir][LLVM] Remove redundant `custom<LLVMOpAttrs>` (#116207)
This custom printer was previously used to avoid printing fast math
flags if they have default values.
This is redundant however, as `attr-dict` will already elide attributes
whose default values are set, making it a noop nowadays.
Added:
Modified:
mlir/include/mlir/Dialect/LLVMIR/LLVMIntrinsicOps.td
mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
Removed:
################################################################################
diff --git a/mlir/include/mlir/Dialect/LLVMIR/LLVMIntrinsicOps.td b/mlir/include/mlir/Dialect/LLVMIR/LLVMIntrinsicOps.td
index a93cec6e9bf8a4..a7d683438ee8ab 100644
--- a/mlir/include/mlir/Dialect/LLVMIR/LLVMIntrinsicOps.td
+++ b/mlir/include/mlir/Dialect/LLVMIR/LLVMIntrinsicOps.td
@@ -19,7 +19,7 @@ class LLVM_UnaryIntrOpBase<string func, Type element,
!listconcat([Pure, SameOperandsAndResultType], traits),
requiresFastmath> {
dag commonArgs = (ins LLVM_ScalarOrVectorOf<element>:$in);
- let assemblyFormat = "`(` operands `)` custom<LLVMOpAttrs>(attr-dict) `:` "
+ let assemblyFormat = "`(` operands `)` attr-dict `:` "
"functional-type(operands, results)";
}
@@ -42,7 +42,7 @@ class LLVM_BinarySameArgsIntrOpBase<string func, Type element,
requiresFastmath> {
dag commonArgs = (ins LLVM_ScalarOrVectorOf<element>:$a,
LLVM_ScalarOrVectorOf<element>:$b);
- let assemblyFormat = "`(` operands `)` custom<LLVMOpAttrs>(attr-dict) `:` "
+ let assemblyFormat = "`(` operands `)` attr-dict `:` "
"functional-type(operands, results)";
}
@@ -67,7 +67,7 @@ class LLVM_TernarySameArgsIntrOpBase<string func, Type element,
dag commonArgs = (ins LLVM_ScalarOrVectorOf<element>:$a,
LLVM_ScalarOrVectorOf<element>:$b,
LLVM_ScalarOrVectorOf<element>:$c);
- let assemblyFormat = "`(` operands `)` custom<LLVMOpAttrs>(attr-dict) `:` "
+ let assemblyFormat = "`(` operands `)` attr-dict `:` "
"functional-type(operands, results)";
}
@@ -137,7 +137,7 @@ def LLVM_PowIOp : LLVM_OneResultIntrOp<"powi", [], [0,1],
(ins LLVM_ScalarOrVectorOf<LLVM_AnyFloat>:$val,
AnySignlessInteger:$power,
DefaultValuedAttr<LLVM_FastmathFlagsAttr, "{}">:$fastmathFlags);
- let assemblyFormat = "`(` operands `)` custom<LLVMOpAttrs>(attr-dict) `:` "
+ let assemblyFormat = "`(` operands `)` attr-dict `:` "
"functional-type(operands, results)";
}
def LLVM_RintOp : LLVM_UnaryIntrOpF<"rint">;
@@ -145,7 +145,7 @@ def LLVM_NearbyintOp : LLVM_UnaryIntrOpF<"nearbyint">;
class LLVM_IntRoundIntrOpBase<string func> :
LLVM_OneResultIntrOp<func, [0], [0], [Pure]> {
let arguments = (ins LLVM_AnyFloat:$val);
- let assemblyFormat = "`(` operands `)` custom<LLVMOpAttrs>(attr-dict) `:` "
+ let assemblyFormat = "`(` operands `)` attr-dict `:` "
"functional-type(operands, results)";
}
def LLVM_LroundOp : LLVM_IntRoundIntrOpBase<"lround">;
@@ -750,7 +750,7 @@ class LLVM_VecReductionF<string mnem>
ins DefaultValuedAttr<LLVM_FastmathFlagsAttr, "{}">:$fastmathFlags);
let arguments = !con(commonArgs, fmfArg);
- let assemblyFormat = "`(` operands `)` custom<LLVMOpAttrs>(attr-dict) `:` "
+ let assemblyFormat = "`(` operands `)` attr-dict `:` "
"functional-type(operands, results)";
}
diff --git a/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td b/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
index 65a35b838ed928..5636ee4d9a1109 100644
--- a/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
+++ b/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
@@ -45,7 +45,7 @@ class LLVM_ArithmeticOpBase<Type type, string mnemonic,
LLVM_ScalarOrVectorOf<type>:$rhs);
let results = (outs LLVM_ScalarOrVectorOf<type>:$res);
let builders = [LLVM_OneResultOpBuilder];
- let assemblyFormat = "$lhs `,` $rhs custom<LLVMOpAttrs>(attr-dict) `:` type($res)";
+ let assemblyFormat = "$lhs `,` $rhs attr-dict `:` type($res)";
string llvmInstName = instName;
}
class LLVM_IntArithmeticOp<string mnemonic, string instName,
@@ -118,7 +118,7 @@ class LLVM_UnaryFloatArithmeticOp<Type type, string mnemonic,
DefaultValuedAttr<LLVM_FastmathFlagsAttr, "{}">:$fastmathFlags);
let results = (outs type:$res);
let builders = [LLVM_OneResultOpBuilder];
- let assemblyFormat = "$operand custom<LLVMOpAttrs>(attr-dict) `:` type($res)";
+ let assemblyFormat = "$operand attr-dict `:` type($res)";
string llvmInstName = instName;
string mlirBuilder = [{
auto op = $_builder.create<$_qualCppClassName>($_location, $operand);
diff --git a/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp b/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
index 2b46a2e393fdd9..9bb0c80749a5f5 100644
--- a/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
+++ b/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
@@ -132,17 +132,6 @@ static auto processFMFAttr(ArrayRef<NamedAttribute> attrs) {
return filteredAttrs;
}
-static ParseResult parseLLVMOpAttrs(OpAsmParser &parser,
- NamedAttrList &result) {
- return parser.parseOptionalAttrDict(result);
-}
-
-static void printLLVMOpAttrs(OpAsmPrinter &printer, Operation *op,
- DictionaryAttr attrs) {
- auto filteredAttrs = processFMFAttr(attrs.getValue());
- printer.printOptionalAttrDict(filteredAttrs);
-}
-
/// Verifies `symbol`'s use in `op` to ensure the symbol is a valid and
/// fully defined llvm.func.
static LogicalResult verifySymbolAttrUse(FlatSymbolRefAttr symbol,
More information about the Mlir-commits
mailing list