[PATCH] D78975: Make ops with StructAttr's actually verify `isa<TheStruct>`.

Sean Silva via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 27 18:20:46 PDT 2020


silvas created this revision.
silvas added reviewers: antiagainst, rriddle.
Herald added subscribers: llvm-commits, Kayjukh, frgossen, grosul1, Joonsoo, liufengdb, aartbik, lucyrfox, mgester, arpith-jacob, nicolasvasilache, shauheen, jpienaar, mehdi_amini, mgorny.
Herald added 1 blocking reviewer(s): rriddle.
Herald added a project: LLVM.

Previously, they would only only verify `isa<DictionaryAttr>` on such attrs
which resulted in crashes down the line from code assuming that the
verifier was doing the more thorough check introduced in this patch.
The key change here is for StructAttr to use
`CPred<"$_self.isa<" # name # ">()">` instead of `isa<DictionaryAttr>`.

To test this, introduce struct attrs to the test dialect. Previously,
StructAttr was only being tested by unittests/, which didn't verify how
StructAttr interacted with ODS.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D78975

Files:
  mlir/include/mlir/IR/OpBase.td
  mlir/test/IR/attribute.mlir
  mlir/test/lib/Dialect/Test/CMakeLists.txt
  mlir/test/lib/Dialect/Test/TestDialect.cpp
  mlir/test/lib/Dialect/Test/TestDialect.h
  mlir/test/lib/Dialect/Test/TestOps.td

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D78975.260513.patch
Type: text/x-patch
Size: 4641 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200428/46c844e5/attachment.bin>


More information about the llvm-commits mailing list