Page MenuHomePhabricator

[mlir] Canonicaliztion of shape.cstr_eq
ClosedPublic

Authored by tpopp on May 20 2020, 9:08 AM.

Details

Summary

In the case of all inputs being constant and equal, cstr_eq will be
replaced with a true_witness.

Diff Detail

Event Timeline

tpopp created this revision.May 20 2020, 9:08 AM
Herald added a reviewer: silvas. · View Herald Transcript
Herald added a project: Restricted Project. · View Herald Transcript
silvas accepted this revision.May 20 2020, 11:40 AM

LGTM, but please look into making these be folds instead of canonicalization patterns. That should also make the code simpler since the folding infra will give you the folded attributes pre-canned without having to do as much getDefiningOp<ConstShapeOp>().

mlir/lib/Dialect/Shape/IR/ShapeCanonicalization.td
14

This is technically a fold, right?

jpienaar accepted this revision.May 20 2020, 5:28 PM
jpienaar added inline comments.
mlir/lib/Dialect/Shape/IR/Shape.cpp
299

I think we are using true and successful witness interchangeably, should we just pick one?

mlir/lib/Dialect/Shape/IR/ShapeCanonicalization.td
6

Same comments re-formatting.

This revision is now accepted and ready to land.May 20 2020, 5:28 PM
tpopp updated this revision to Diff 268479.Jun 4 2020, 8:10 AM
tpopp marked 3 inline comments as done.

Replace with folding and handle non-const but equal inputs.

Herald added a project: Restricted Project. · View Herald TranscriptJun 4 2020, 8:10 AM
This revision was automatically updated to reflect the committed changes.