[PATCH] D80305: [mlir] Add folding for shape.any
Jacques Pienaar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed May 20 17:08:02 PDT 2020
jpienaar accepted this revision.
jpienaar marked an inline comment as done.
jpienaar added inline comments.
This revision is now accepted and ready to land.
================
Comment at: mlir/lib/Dialect/Shape/IR/Shape.cpp:106
+// determined through mixtures of the known dimensions of the inputs.
+OpFoldResult AnyOp::fold(ArrayRef<Attribute> operands) {
+ // Only the last operand is checked because AnyOp is commutative.
----------------
So the folder only focuses on case where the output can be fully statically computed? [this overlaps with Sean's question below]
================
Comment at: mlir/lib/Dialect/Shape/IR/Shape.cpp:108
+ // Only the last operand is checked because AnyOp is commutative.
+ if (operands.back())
+ return operands.back();
----------------
Nit: Perhaps expand the comment slightly: it is commutative and so constants have been moved to the trailing operands.
This would be known to someone who read the canonicalization doc or looked at FoldUtils.cpp , but I think it is useful to avoid needing that context especially as short.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D80305/new/
https://reviews.llvm.org/D80305
More information about the llvm-commits
mailing list