Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion mlir/lib/Dialect/Vector/IR/VectorOps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6516,9 +6516,15 @@ ParseResult MaskOp::parse(OpAsmParser &parser, OperationState &result) {
if (parser.resolveOperand(mask, maskType, result.operands))
return failure();

if (parsePassthru.succeeded())
if (parsePassthru.succeeded()) {
if (resultTypes.empty())
return parser.emitError(
parser.getNameLoc(),
"expects a result if passthru operand is provided");

if (parser.resolveOperand(passthru, resultTypes[0], result.operands))
return failure();
}

return success();
}
Expand Down
18 changes: 18 additions & 0 deletions mlir/test/Dialect/Vector/invalid.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -1747,6 +1747,24 @@ func.func @vector_mask_0d_mask(%arg0: tensor<2x4xi32>,

// -----

func.func @vector_mask_empty_passthru_no_return_type(%mask : vector<8xi1>,
%passthru : vector<8xi32>) {
// expected-error@+1 {{'vector.mask' expects a result if passthru operand is provided}}
vector.mask %mask, %passthru { } : vector<8xi1>
return
}

// -----

func.func @vector_mask_empty_passthru_empty_return_type(%mask : vector<8xi1>,
%passthru : vector<8xi32>) {
// expected-error@+1 {{'vector.mask' expects a result if passthru operand is provided}}
vector.mask %mask, %passthru { } : vector<8xi1> -> ()
return
}

// -----

func.func @vector_scalable_insert_unaligned(%subv: vector<4xi32>, %vec: vector<[16]xi32>) {
// expected-error@+1 {{op failed to verify that position is a multiple of the source length.}}
%0 = vector.scalable.insert %subv, %vec[2] : vector<4xi32> into vector<[16]xi32>
Expand Down