Skip to content

Commit 3ae7790

Browse files
author
Zhang Yan
committed
fix comment
1 parent e38eb33 commit 3ae7790

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

mlir/include/mlir/Dialect/Arith/IR/ArithOps.td

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1209,7 +1209,9 @@ def Arith_ExtFOp : Arith_FToFCastOp<"extf", [DeclareOpInterfaceMethods<ArithFast
12091209
let hasVerifier = 1;
12101210
let hasFolder = 1;
12111211

1212-
let arguments = (ins FloatLike:$in, OptionalAttr<Arith_FastMathAttr>:$fastmath);
1212+
let arguments = (ins FloatLike:$in,
1213+
DefaultValuedOptionalAttr<
1214+
Arith_FastMathAttr, "::mlir::arith::FastMathFlags::none">:$fastmath);
12131215
let results = (outs FloatLike:$out);
12141216

12151217
let assemblyFormat = [{ $in (`fastmath` `` $fastmath^)?
@@ -1256,7 +1258,8 @@ def Arith_TruncFOp :
12561258
DeclareOpInterfaceMethods<CastOpInterface>]>,
12571259
Arguments<(ins FloatLike:$in,
12581260
OptionalAttr<Arith_RoundingModeAttr>:$roundingmode,
1259-
OptionalAttr<Arith_FastMathAttr>:$fastmath)>,
1261+
DefaultValuedOptionalAttr<
1262+
Arith_FastMathAttr, "::mlir::arith::FastMathFlags::none">:$fastmath)>,
12601263
Results<(outs FloatLike:$out)> {
12611264
let summary = "cast from floating-point to narrower floating-point";
12621265
let description = [{

mlir/lib/Dialect/Arith/IR/ArithOps.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1392,13 +1392,10 @@ LogicalResult arith::ExtSIOp::verify() {
13921392
OpFoldResult arith::ExtFOp::fold(FoldAdaptor adaptor) {
13931393
if (auto truncFOp = getOperand().getDefiningOp<TruncFOp>()) {
13941394
if (truncFOp.getOperand().getType() == getType()) {
1395-
arith::FastMathFlags truncFMF =
1396-
truncFOp.getFastmath().value_or(arith::FastMathFlags::none);
1395+
arith::FastMathFlags truncFMF = truncFOp.getFastmath();
13971396
bool isTruncContract =
13981397
bitEnumContainsAll(truncFMF, arith::FastMathFlags::contract);
1399-
arith::FastMathFlags extFMF =
1400-
getFastmath().value_or(arith::FastMathFlags::none);
1401-
;
1398+
arith::FastMathFlags extFMF = getFastmath();
14021399
bool isExtContract =
14031400
bitEnumContainsAll(extFMF, arith::FastMathFlags::contract);
14041401
if (isTruncContract && isExtContract) {

0 commit comments

Comments
 (0)