[llvm-dev] Change memcpy/memmove/memset to have dest and source alignment attributes

Daniel Neilson via llvm-dev llvm-dev at lists.llvm.org
Tue Jan 2 12:11:37 PST 2018

Good day all,
 I’ve spent a few days resurrecting the circa-2015 work on removing the explicit alignment argument (4th arg) from the @llvm.memcpy/memmove/memset intrinsics in favour of using the alignment attribute on the pointer args of calls to the intrinsic. This work was first proposed back in August 2015 by Lang Hames:
http://lists.llvm.org/pipermail/llvm-dev/2015-August/089384.html   (item 2)
 and an attempt at landing the work was made by Pete Cooper in November 2015, but then backed out due to unspecified bot failures:

 I’ve prepared changes for LLVM, Clang, and Polly that are now up for review:
* https://reviews.llvm.org/D41675   (LLVM part)
* https://reviews.llvm.org/D41676   (polly part)
* https://reviews.llvm.org/D41677   (Clang part)

 Importantly for those maintaining downstream users of the LLVM API, this changes the prototypes for the @llvm.memcpy/memmove/memset intrinsics and changes the IRBuilder API for creating memcpy and memmove calls.

For example, IR which used to read:
     call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dest, i8* %src, i32 100, i32 4, i1 false)
will now read
     call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 4 %dest, i8* align 4 %src, i32 100, i1 false)

 The LLVM change includes auto upgrade of the old IR. However, match expressions in IR tests and calls to IRBuilder’s CreateMemCpy & CreateMemMove will need to be updated.

 My plan is to post another note to the list when the change is landed, and stable.

 Comments? Concerns?


Daniel Neilson, Ph.D.
Azul Systems

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180102/f44b211d/attachment.html>

More information about the llvm-dev mailing list