This is an archive of the discontinued LLVM Phabricator instance.

[mlir] [memref] Fix alignment bug in memref.copy lowering
ClosedPublic

Authored by ubfx on Jul 24 2023, 7:17 AM.

Details

Summary

memref.copy gets lowered to a function call sometimes, this function
is passed the element size of the memref in bytes as an argument.
The element size passed to the copyMemRef() function call can be
miscalculated if the LLVM IR uses aligned access to the memory.

This can be fixed by using llvm.getelementptr to calculate the element
size natively. This is also done in the other lowering path that lowers
to an intrinsic.

Fix https://github.com/llvm/llvm-project/issues/64072

Diff Detail

Event Timeline

ubfx created this revision.Jul 24 2023, 7:17 AM
Herald added a reviewer: dcaballe. · View Herald Transcript
Herald added a project: Restricted Project. · View Herald Transcript
ubfx requested review of this revision.Jul 24 2023, 7:17 AM

Nit: If you write your commit message with Fix #64072 (or Fix <url>) then the issue will be closed and linked to the commit.

ubfx updated this revision to Diff 544431.Jul 26 2023, 10:37 AM
ubfx edited the summary of this revision. (Show Details)

Link github issue to the commit correctly

ftynse accepted this revision.Sep 14 2023, 4:17 AM
This revision is now accepted and ready to land.Sep 14 2023, 4:17 AM
This revision was automatically updated to reflect the committed changes.