[PATCH] D80304: [mlir] Canonicalization of shape.cstr_broadcastable
Theodore Popp via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 4 08:12:18 PDT 2020
tpopp added inline comments.
================
Comment at: mlir/lib/Dialect/Shape/IR/Shape.cpp:265
+// operation.
+// TODO: Once Witnesses are Attributes, replace this with folding.
+struct CstrBroadcastableTrue : public OpRewritePattern<CstrBroadcastableOp> {
----------------
silvas wrote:
> As far as the constant folding logic, you can just use an i1 for a witness. You just need to add a case in ShapeDialect::materializeConstant know how to materialize it into a true_witness op or false_witness op (or just a single const_witness?).
>
> Maybe you can rename this patch "introduce basic constant folding for witnesses" and use this fold as the first example?
It took me a long time to figure out that I could use a BoolAttr for this. In the spirit of small commits, I'm leaving the ConstWitnessOp creation separate, but I'm not folding this for constant false witnesses because that needs to be carefully thought through as that is removing an assert that can be triggered.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D80304/new/
https://reviews.llvm.org/D80304
More information about the llvm-commits
mailing list