From 40493a07a3ca8c526cd2b823863f76451eed693f Mon Sep 17 00:00:00 2001 From: River Riddle Date: Mon, 22 Jul 2019 15:06:15 -0700 Subject: [PATCH] Emit an error for missing '[' when parsing an AffineMapOfSSAIds. Fixes tensorflow/mlir#51 PiperOrigin-RevId: 259415034 --- mlir/lib/Parser/Parser.cpp | 2 +- mlir/test/AffineOps/invalid.mlir | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/mlir/lib/Parser/Parser.cpp b/mlir/lib/Parser/Parser.cpp index d227abd38540..00c5c2f6d8ad 100644 --- a/mlir/lib/Parser/Parser.cpp +++ b/mlir/lib/Parser/Parser.cpp @@ -2329,7 +2329,7 @@ ParseResult AffineParser::parseAffineMapOrIntegerSetInline(AffineMap &map, /// Parse an AffineMap where the dim and symbol identifiers are SSA ids. ParseResult AffineParser::parseAffineMapOfSSAIds(AffineMap &map) { - if (!consumeIf(Token::l_square)) + if (parseToken(Token::l_square, "expected '['")) return failure(); SmallVector exprs; diff --git a/mlir/test/AffineOps/invalid.mlir b/mlir/test/AffineOps/invalid.mlir index 43ea0ec3b345..5a8c24262413 100644 --- a/mlir/test/AffineOps/invalid.mlir +++ b/mlir/test/AffineOps/invalid.mlir @@ -142,3 +142,12 @@ func @affine_if_invalid_dimop_dim(%arg0: index, %arg1: index, %arg2: index, %arg } return } + +// ----- + +func @affine_store_missing_l_square(%C: memref<4096x4096xf32>) { + %9 = constant 0.0 : f32 + // expected-error@+1 {{expected '['}} + affine.store %9, %C : memref<4096x4096xf32> + return +}