summaryrefslogtreecommitdiff
path: root/mlir/lib/Interfaces/DestinationStyleOpInterface.cpp
diff options
context:
space:
mode:
authorMatthias Springer <springerm@google.com>2022-10-27 10:17:31 +0200
committerMatthias Springer <springerm@google.com>2022-10-27 10:25:04 +0200
commitec2ea41073b629e404ab1ff57fdbc3945d5e8a06 (patch)
tree577ac9a51d16a997a6650a6079b313279de282d6 /mlir/lib/Interfaces/DestinationStyleOpInterface.cpp
parent826f38534816ff2890639e3a75d9d7381ffde5ac (diff)
[mlir][interfaces] Allow only ranked tensors/memrefs in DestinationStyleOpInterface
We have currently no need for unranked tensors/memrefs. Differential Revision: https://reviews.llvm.org/D136588
Diffstat (limited to 'mlir/lib/Interfaces/DestinationStyleOpInterface.cpp')
-rw-r--r--mlir/lib/Interfaces/DestinationStyleOpInterface.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/mlir/lib/Interfaces/DestinationStyleOpInterface.cpp b/mlir/lib/Interfaces/DestinationStyleOpInterface.cpp
index 104b0fa4cb37..d89914e6585a 100644
--- a/mlir/lib/Interfaces/DestinationStyleOpInterface.cpp
+++ b/mlir/lib/Interfaces/DestinationStyleOpInterface.cpp
@@ -29,10 +29,15 @@ LogicalResult detail::verifyDestinationStyleOpInterface(Operation *op) {
SmallVector<OpOperand *> outputBufferOperands, outputTensorOperands;
for (OpOperand *operand : dstStyleOp.getOutputOperands()) {
Type type = operand->get().getType();
- if (type.isa<MemRefType>())
+ if (type.isa<MemRefType>()) {
outputBufferOperands.push_back(operand);
- if (type.isa<RankedTensorType>())
+ } else if (type.isa<RankedTensorType>()) {
outputTensorOperands.push_back(operand);
+ } else {
+ return op->emitOpError("expected that operand #")
+ << operand->getOperandNumber()
+ << " is a ranked tensor or a ranked memref";
+ }
}
// Expect at least one output operand.