This is an archive of the discontinued LLVM Phabricator instance.

[mlir] do not emit bitcasts between structs in StandardToLLVM
ClosedPublic

Authored by ftynse on Aug 13 2020, 5:46 AM.

Details

Summary

The convresion of memref cast operaitons from the Standard dialect to the LLVM
dialect has been emitting bitcasts from a struct type to itself. Beyond being
useless, such casts are invalid as bitcast does not operate on aggregate types.
This kept working by accident because LLVM IR bitcast construction API skips
the construction if types are equal before it verifies that the types are
acceptable in a bitcast. Do not emit such bitcasts, the memref cast that only
adds/erases size information is in fact a noop on the current descriptor as it
always contains dynamic values for all sizes.

Diff Detail

Event Timeline

ftynse created this revision.Aug 13 2020, 5:46 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 13 2020, 5:46 AM
ftynse requested review of this revision.Aug 13 2020, 5:46 AM

Thank you, Alex. There are also a couple of redundant bitcasts in LHLO memref cast ops -> llvm conversion. That reminds me to clean them up as well.

pifon2a accepted this revision.Aug 13 2020, 11:14 AM
This revision is now accepted and ready to land.Aug 13 2020, 11:14 AM

Thanks, Alex!