[PATCH] D76020: [mlir] Add a new `ConstantLike` trait to better identify operations that represent a "constant".

Jacques Pienaar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 12 11:23:35 PDT 2020


jpienaar accepted this revision.
jpienaar marked an inline comment as done.
jpienaar added a comment.
This revision is now accepted and ready to land.

Seems reasonable :) Thanks



================
Comment at: mlir/include/mlir/IR/Matchers.h:51
 
+/// The matcher that matches a constant foldable operation that has no side
+/// effect, no operands and produces a single result.
----------------
Update comment?


================
Comment at: mlir/include/mlir/IR/OpDefinition.h:916
+                  "expected operation to take zero operands");
+    // TODO: We should verify that the operation can always be folded, but this
+    // requires that the attributes of the op already be verified. We should add
----------------
What would happen if this wasn't true for the op? What error/assert/failure would be triggered?


================
Comment at: mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp:1551
+
+  // Add the native and interface traits.
+  for (const auto &trait : op.getTraits()) {
----------------
I think we also are missing documentation on the ordering effect of traits and even discussion pending on if order should matter ...


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76020





More information about the llvm-commits mailing list