[PATCH] D77104: [mlir] Add a pre-check before checking constraints of an optional attribute.

Lei Zhang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 31 13:07:51 PDT 2020


antiagainst added inline comments.


================
Comment at: mlir/tools/mlir-tblgen/RewriterGen.cpp:385
+    if (attr.isOptional()) {
+      os.indent(indent) << "}\n";
+      indent -= 2;
----------------
What happens if I have a matcher like `IntValueIsFive` but an op instance does not have the attribute? I would expect the match to fail but per the implementation here, it will succeed because of the check is not performed?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D77104





More information about the llvm-commits mailing list