[PATCH] D72397: m_Constant()

River Riddle via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 8 10:30:52 PST 2020


rriddle added inline comments.


================
Comment at: mlir/include/mlir/IR/Matchers.h:71
       if (auto attr = foldedOp.front().dyn_cast<Attribute>()) {
+        if (!bind_value)
+          return true;
----------------
Seems like this will be prone to subtle failure if we allow matching attribute kinds other than `Attribute`. I would check the cast(and optionally set 'bind_value') before returning true.

Another alternative would be to just have another matcher class(that inherits from this one) that contains a field for the attribute to bind.


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

https://reviews.llvm.org/D72397





More information about the llvm-commits mailing list