[PATCH] D110826: [fir][NFC] Move fir.shape verifier to cpp file
Valentin Clement via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 30 06:29:51 PDT 2021
clementval created this revision.
clementval added reviewers: jeanPerier, svedanayagam, sscalpone, kiranchandramohan, jdoerfert, schweitz, pmccormick, mehdi_amini, rovka, AlexisPerry.
Herald added a project: Flang.
clementval requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Move verifier code to the .cpp file.
Follow up to https://reviews.llvm.org/D110626.
This patch is part of the upstreaming effort from fir-dev branch.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D110826
Files:
flang/include/flang/Optimizer/Dialect/FIROps.td
flang/lib/Optimizer/Dialect/FIROps.cpp
Index: flang/lib/Optimizer/Dialect/FIROps.cpp
===================================================================
--- flang/lib/Optimizer/Dialect/FIROps.cpp
+++ flang/lib/Optimizer/Dialect/FIROps.cpp
@@ -2606,6 +2606,19 @@
return mlir::success();
}
+//===----------------------------------------------------------------------===//
+// ShapeOp
+//===----------------------------------------------------------------------===//
+
+static mlir::LogicalResult verify(fir::ShapeOp &op) {
+ auto size = op.extents().size();
+ auto shapeTy = op.getType().dyn_cast<fir::ShapeType>();
+ assert(shapeTy && "must be a shape type");
+ if (shapeTy.getRank() != size)
+ return op.emitOpError("shape type rank mismatch");
+ return mlir::success();
+}
+
//===----------------------------------------------------------------------===//
// ShapeShiftOp
//===----------------------------------------------------------------------===//
Index: flang/include/flang/Optimizer/Dialect/FIROps.td
===================================================================
--- flang/include/flang/Optimizer/Dialect/FIROps.td
+++ flang/include/flang/Optimizer/Dialect/FIROps.td
@@ -1868,14 +1868,7 @@
operands attr-dict `:` functional-type(operands, results)
}];
- let verifier = [{
- auto size = extents().size();
- auto shapeTy = getType().dyn_cast<fir::ShapeType>();
- assert(shapeTy && "must be a shape type");
- if (shapeTy.getRank() != size)
- return emitOpError("shape type rank mismatch");
- return mlir::success();
- }];
+ let verifier = "return ::verify(*this);";
let extraClassDeclaration = [{
std::vector<mlir::Value> getExtents() {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D110826.376182.patch
Type: text/x-patch
Size: 1669 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210930/293b71f7/attachment.bin>
More information about the llvm-commits
mailing list