Skip to content

[MLIR][LLVM] Cleanup attr-dict printing (NFC) #115765

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,7 @@ class LLVM_IntArithmeticOpWithOverflowFlag<string mnemonic, string instName,
$res = op;
}];
let assemblyFormat = [{
$lhs `,` $rhs `` custom<OverflowFlags>($overflowFlags)
`` custom<LLVMOpAttrs>(attr-dict) `:` type($res)
$lhs `,` $rhs `` custom<OverflowFlags>($overflowFlags) attr-dict `:` type($res)
}];
string llvmBuilder =
"$res = builder.Create" # instName #
Expand All @@ -88,7 +87,7 @@ class LLVM_IntArithmeticOpWithExactFlag<string mnemonic, string instName,
$res = op;
}];
let assemblyFormat = [{
(`exact` $isExact^)? $lhs `,` $rhs custom<LLVMOpAttrs>(attr-dict) `:` type($res)
(`exact` $isExact^)? $lhs `,` $rhs attr-dict `:` type($res)
}];
string llvmBuilder =
"$res = builder.Create" # instName #
Expand Down
10 changes: 1 addition & 9 deletions mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,15 +140,7 @@ static ParseResult parseLLVMOpAttrs(OpAsmParser &parser,
static void printLLVMOpAttrs(OpAsmPrinter &printer, Operation *op,
DictionaryAttr attrs) {
auto filteredAttrs = processFMFAttr(attrs.getValue());
if (auto iface = dyn_cast<IntegerOverflowFlagsInterface>(op)) {
printer.printOptionalAttrDict(
filteredAttrs, /*elidedAttrs=*/{iface.getOverflowFlagsAttrName()});
} else if (auto iface = dyn_cast<ExactFlagInterface>(op)) {
printer.printOptionalAttrDict(filteredAttrs,
/*elidedAttrs=*/{iface.getIsExactName()});
} else {
printer.printOptionalAttrDict(filteredAttrs);
}
printer.printOptionalAttrDict(filteredAttrs);
}

/// Verifies `symbol`'s use in `op` to ensure the symbol is a valid and
Expand Down
Loading