This is an archive of the discontinued LLVM Phabricator instance.

[mlir] Add folding of memref_cast inside another memref_cast
ClosedPublic

Authored by ftynse on Nov 6 2020, 1:20 AM.

Details

Summary

There exists a generic folding facility that folds the operand of a memref_cast
into users of memref_cast that support this. However, it was not used for the
memref_cast itself. Fix it to enable elimination of memref_cast chains such as

%1 = memref_cast %0 : A to B
%2 = memref_cast %1 : B to A

that is achieved by combining the folding with the existing "A to A" cast
elimination.

Diff Detail

Event Timeline

ftynse created this revision.Nov 6 2020, 1:20 AM
ftynse requested review of this revision.Nov 6 2020, 1:20 AM
nicolasvasilache accepted this revision.Nov 6 2020, 1:37 AM
This revision is now accepted and ready to land.Nov 6 2020, 1:37 AM