Page MenuHomePhabricator

Fix expand folder to avoid folding memref cast
AcceptedPublic

Authored by cathyzhyi on Mon, Nov 22, 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.Mon, Nov 22, 11:50 AM
cathyzhyi requested review of this revision.Mon, Nov 22, 11:50 AM
silvas added a subscriber: herhut.Mon, Nov 22, 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.Tue, Nov 30, 9:24 AM
This revision is now accepted and ready to land.Tue, Nov 30, 9:24 AM