[PATCH] D80306: [mlir] Canonicalization of shape.assuming_all
Stephan Herhut via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon May 25 04:46:32 PDT 2020
herhut accepted this revision.
herhut added a comment.
Feel free to land. Comments are just suggestions and can also be addressed in a follow up.
================
Comment at: mlir/lib/Dialect/Shape/IR/ShapeCanonicalization.td:6
+ llvm::all_of($0.getOwner()->getOperands(), [](mlir::Value op) {
+ return op.getDefiningOp<mlir::shape::TrueWitnessOp>();
+ })
----------------
This would be a great place to use the `isTrueWitness` helper.
================
Comment at: mlir/lib/Dialect/Shape/IR/ShapeCanonicalization.td:11
+// Canonicalization patterns.
+def ConstantAssumingAll : Pat<(Shape_AssumingAllOp:$op $input),
+ (Shape_TrueWitnessOp),
----------------
This could also be formulated as a pattern that drops constant true witnesses from the operands and a pattern that replaces an `assuming_all` with no operands by a constant true witness. That way we also get removal of constant operands (which is more a cosmetic cleanup and does not really propagate any knowledge).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D80306/new/
https://reviews.llvm.org/D80306
More information about the llvm-commits
mailing list