[PATCH] D76493: mlir: Fix attribute parser errors for ui64

River Riddle via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 23 10:55:54 PDT 2020


rriddle added inline comments.


================
Comment at: mlir/test/lib/TestDialect/TestOps.td:214
 
+def I8AttrValueOp : TEST_Op<"i8_attr"> {
+  let arguments = (ins AnyI8Attr:$attr);
----------------
frej wrote:
> rriddle wrote:
> > None of these are necessary for checking the parser.
> Please explain. How can I check that values are valid for an attribute of a given width without having an operator with such an attribute? The best solution I can come up with is a single operator using an APInt attribute:
> 
> ```
> def APIntAttrValueOp : TEST_Op<"apint_attr"> {
>   let arguments = (ins APIntAttr:$attr);
> }
> ```
> 
> Would this be acceptable or did you have another solution in mind?
What I mean is; when you are testing error handling inside of the Parser/AsmPrinter you don't need to register any operations. MLIR doesn't require that you register operations. You could have `foo.op` and still trigger the necessary code paths inside of the parser/printer.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D76493/new/

https://reviews.llvm.org/D76493





More information about the llvm-commits mailing list