[Mlir-commits] [mlir] cb65419 - [mlir] Simplify folding code (NFC)
Adrian Kuegel
llvmlistbot at llvm.org
Wed May 26 02:00:21 PDT 2021
Author: Adrian Kuegel
Date: 2021-05-26T11:00:07+02:00
New Revision: cb65419b1ac05c3020dd05b64db183712235d2ff
URL: https://github.com/llvm/llvm-project/commit/cb65419b1ac05c3020dd05b64db183712235d2ff
DIFF: https://github.com/llvm/llvm-project/commit/cb65419b1ac05c3020dd05b64db183712235d2ff.diff
LOG: [mlir] Simplify folding code (NFC)
Added:
Modified:
mlir/lib/Dialect/Complex/IR/ComplexOps.cpp
Removed:
################################################################################
diff --git a/mlir/lib/Dialect/Complex/IR/ComplexOps.cpp b/mlir/lib/Dialect/Complex/IR/ComplexOps.cpp
index 271ba66b7a48..34e27d688276 100644
--- a/mlir/lib/Dialect/Complex/IR/ComplexOps.cpp
+++ b/mlir/lib/Dialect/Complex/IR/ComplexOps.cpp
@@ -24,7 +24,7 @@ OpFoldResult ReOp::fold(ArrayRef<Attribute> operands) {
ArrayAttr arrayAttr = operands[0].dyn_cast_or_null<ArrayAttr>();
if (arrayAttr && arrayAttr.size() == 2)
return arrayAttr[0];
- if (auto createOp = dyn_cast_or_null<CreateOp>(getOperand().getDefiningOp()))
+ if (auto createOp = getOperand().getDefiningOp<CreateOp>())
return createOp.getOperand(0);
return {};
}
@@ -34,7 +34,7 @@ OpFoldResult ImOp::fold(ArrayRef<Attribute> operands) {
ArrayAttr arrayAttr = operands[0].dyn_cast_or_null<ArrayAttr>();
if (arrayAttr && arrayAttr.size() == 2)
return arrayAttr[1];
- if (auto createOp = dyn_cast_or_null<CreateOp>(getOperand().getDefiningOp()))
+ if (auto createOp = getOperand().getDefiningOp<CreateOp>())
return createOp.getOperand(1);
return {};
}
More information about the Mlir-commits
mailing list