This is an archive of the discontinued LLVM Phabricator instance.

Fix expand folder to avoid folding memref cast
AcceptedPublic

Authored by cathyzhyi on Nov 22 2021, 11:50 AM.

Details

Summary

memref.expand_shape has verification logic to make sure
src type is compatible with the result type.
Cast folding might add/remove static information for the src operand
of memref.expand_shape which will change operation to be invalid.
The only case where it's legal to fold the memref cast is actually
when the cast doesn't change the type info. This case is handled by
memref.cast folder already.

Diff Detail

Event Timeline

cathyzhyi created this revision.Nov 22 2021, 11:50 AM
cathyzhyi requested review of this revision.Nov 22 2021, 11:50 AM
silvas added a subscriber: herhut.Nov 22 2021, 12:50 PM

The idea here of preventing invalid ops makes sense to me, but @herhut probably is more knowledgeable about this code for a detailed review.

This was recently fixed in https://reviews.llvm.org/D114391. If you rebase, you should pick up that change.

Would be great to land those tests, though!

herhut accepted this revision.Nov 30 2021, 9:24 AM
This revision is now accepted and ready to land.Nov 30 2021, 9:24 AM
mravishankar resigned from this revision.May 9 2022, 3:37 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 9 2022, 3:37 PM