This is an archive of the discontinued LLVM Phabricator instance.

[MLIR] Add canonicalization for `shape.broadcast`
ClosedPublic

Authored by frgossen on Mar 11 2021, 2:27 AM.

Details

Summary

Remove redundant operands and fold if only one left.

Diff Detail

Event Timeline

frgossen created this revision.Mar 11 2021, 2:27 AM
frgossen requested review of this revision.Mar 11 2021, 2:27 AM
tpopp accepted this revision.Mar 15 2021, 2:00 AM
tpopp added inline comments.
mlir/lib/Dialect/Shape/IR/Shape.cpp
395

Unless this is convention, I would remove the "Canonicalization" part of the name. nothing about this is limited to canonicalizations.

813–814

return BoolAttr::get(getContext(), true);

816

nullptr?

mlir/test/Dialect/Shape/canonicalize.mlir
1116

add a : or this isn't actually testing that anything was removed I believe.

frgossen updated this revision to Diff 330580.Mar 15 2021, 2:10 AM
frgossen marked 4 inline comments as done.

Address comments

This revision was not accepted when it landed; it landed in state Needs Review.Mar 15 2021, 2:12 AM
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.