Skip to content

Commit cb65419

Browse files
committed
[mlir] Simplify folding code (NFC)
1 parent 9c766f4 commit cb65419

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

mlir/lib/Dialect/Complex/IR/ComplexOps.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ OpFoldResult ReOp::fold(ArrayRef<Attribute> operands) {
2424
ArrayAttr arrayAttr = operands[0].dyn_cast_or_null<ArrayAttr>();
2525
if (arrayAttr && arrayAttr.size() == 2)
2626
return arrayAttr[0];
27-
if (auto createOp = dyn_cast_or_null<CreateOp>(getOperand().getDefiningOp()))
27+
if (auto createOp = getOperand().getDefiningOp<CreateOp>())
2828
return createOp.getOperand(0);
2929
return {};
3030
}
@@ -34,7 +34,7 @@ OpFoldResult ImOp::fold(ArrayRef<Attribute> operands) {
3434
ArrayAttr arrayAttr = operands[0].dyn_cast_or_null<ArrayAttr>();
3535
if (arrayAttr && arrayAttr.size() == 2)
3636
return arrayAttr[1];
37-
if (auto createOp = dyn_cast_or_null<CreateOp>(getOperand().getDefiningOp()))
37+
if (auto createOp = getOperand().getDefiningOp<CreateOp>())
3838
return createOp.getOperand(1);
3939
return {};
4040
}

0 commit comments

Comments
 (0)