Skip to content

Commit

Permalink
[LowerMemIntrinsics] Use i8 GEPs in memcpy/memmove lowering (llvm#112707
Browse files Browse the repository at this point in the history
)

The IR lowering of memcpy/memmove intrinsics uses a target-specific type
for its load/store operations. So far, the loaded and stored addresses
are computed with GEPs based on this type. That is wrong if the
allocation size of the type differs from its store size: The width of
the accesses is determined by the store size, while the GEP stride is
determined by the allocation size. If the allocation size is greater
than the store size, some bytes are not copied/moved.

This patch changes the GEPs to use i8 addressing, with offsets based on
the type's store size. The correctness of the lowering therefore no
longer depends on the type's allocation size.

This is in support of PR llvm#112332, which allows adjusting the memcpy loop
lowering type through a command line argument in the AMDGPU backend.
  • Loading branch information
ritter-x2a authored Oct 22, 2024
1 parent 4275a73 commit 4c697f7
Show file tree
Hide file tree
Showing 5 changed files with 1,458 additions and 1,516 deletions.
Loading

0 comments on commit 4c697f7

Please sign in to comment.