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

River Riddle via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 11 11:53:18 PDT 2020


rriddle created this revision.
rriddle added reviewers: mehdi_amini, jpienaar.
Herald added subscribers: llvm-commits, bader, Joonsoo, liufengdb, lucyrfox, mgester, arpith-jacob, nicolasvasilache, antiagainst, shauheen, burmako.
Herald added a reviewer: mravishankar.
Herald added a reviewer: antiagainst.
Herald added a reviewer: nicolasvasilache.
Herald added a reviewer: antiagainst.
Herald added a project: LLVM.

The current mechanism for identifying is a bit hacky and extremely adhoc, i.e. we explicit check 1-result, 0-operand, no side-effect, and always foldable and then assume that this is a constant. Adding a trait adds structure to this, and makes checking for a constant much more efficient as we can guarantee that all of these things have already been verified.

Depends On D76019 <https://reviews.llvm.org/D76019>


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D76020

Files:
  mlir/examples/toy/Ch7/include/toy/Ops.td
  mlir/include/mlir/Dialect/SPIRV/SPIRVStructureOps.td
  mlir/include/mlir/Dialect/StandardOps/IR/Ops.td
  mlir/include/mlir/IR/Matchers.h
  mlir/include/mlir/IR/OpBase.td
  mlir/include/mlir/IR/OpDefinition.h
  mlir/lib/IR/Builders.cpp
  mlir/lib/Transforms/Utils/FoldUtils.cpp
  mlir/test/Dialect/Linalg/invalid.mlir
  mlir/test/IR/traits.mlir
  mlir/test/mlir-tblgen/op-decl.td
  mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D76020.249707.patch
Type: text/x-patch
Size: 9915 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200311/74fc7e3b/attachment.bin>


More information about the llvm-commits mailing list