Emit an error for missing '[' when parsing an AffineMapOfSSAIds.
authorRiver Riddle <riverriddle@google.com>
Mon, 22 Jul 2019 22:06:15 +0000 (15:06 -0700)
committerA. Unique TensorFlower <gardener@tensorflow.org>
Mon, 22 Jul 2019 22:06:44 +0000 (15:06 -0700)
Fixes tensorflow/mlir#51

PiperOrigin-RevId: 259415034

mlir/lib/Parser/Parser.cpp
mlir/test/AffineOps/invalid.mlir

index d227abd..00c5c2f 100644 (file)
@@ -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<AffineExpr, 4> exprs;
index 43ea0ec..5a8c242 100644 (file)
@@ -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
+}