When parsing DmaWait, check that the tag is a MemRef type.

PiperOrigin-RevId: 229390720
This commit is contained in:
River Riddle 2019-01-15 10:04:28 -08:00 committed by jpienaar
parent 515ce1e68e
commit d50dc4fd6d
2 changed files with 11 additions and 0 deletions

View File

@ -991,6 +991,10 @@ bool DmaWaitOp::parse(OpAsmParser *parser, OperationState *result) {
parser->resolveOperand(numElementsInfo, indexType, result->operands))
return true;
if (!type.isa<MemRefType>())
return parser->emitError(parser->getNameLoc(),
"expected tag to be of memref type");
if (tagIndexInfos.size() != type.cast<MemRefType>().getRank())
return parser->emitError(parser->getNameLoc(),
"tag memref rank not equal to indices count");

View File

@ -476,3 +476,10 @@ func @invalid_select_shape(%cond : i1, %idx : () -> ()) {
func @invalid_cmp_shape(%idx : () -> ()) {
// expected-error@+1 {{expected type with valid i1 shape}}
%cmp = cmpi "eq", %idx, %idx : () -> ()
// -----
func @dma_wait_no_memref(%tag : f32, %c0 : index) {
// expected-error@+1 {{expected tag to be of memref type}}
dma_wait %tag[%c0], %arg0 : f32
}