This is an archive of the discontinued LLVM Phabricator instance.

[MemRef] Restrict dim(reshape) transform to constant indices
AcceptedPublic

Authored by bkramer on Jun 15 2021, 7:39 AM.

Details

Reviewers
pifon2a
herhut
Summary

Since the load is inserted in place of the reshape (so the shape tensor
cannot be overwritten) the index has to dominate the reshape. With a
dynamic index there I don't see a way of enforcing that. Constants are
moved to the top so it's safe to do this transformation for them.

Diff Detail

Event Timeline

bkramer created this revision.Jun 15 2021, 7:39 AM
bkramer requested review of this revision.Jun 15 2021, 7:39 AM
pifon2a accepted this revision.Jun 21 2021, 1:16 AM
pifon2a added inline comments.
mlir/test/Dialect/Standard/canonicalize.mlir
147

maybe insert a couple of CHECK-NOTs to make sure that it actually folded? memref.dim alone would pass with the original IR.

This revision is now accepted and ready to land.Jun 21 2021, 1:16 AM