[PATCH] D42815: [AArch64FastISel] Replace deprecated calls to MemoryIntrinsic::getAlignment() (NFCI)

Daniel Neilson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 1 14:04:13 PST 2018


dneilson created this revision.
dneilson added a reviewer: t.p.northover.
Herald added subscribers: kristof.beyls, javed.absar, rengolin, aemerson.
Herald added a reviewer: bollu.

This change is part of step five in the series of changes to remove alignment argument from
memcpy/memmove/memset in favour of alignment attributes. In particular, this changes
AArch64FastISel to cease using the old getAlignment() API of MemoryIntrinsic in favour of getting
source & dest specific alignments through the new API.

Steps:
Step 1) Remove alignment parameter and create alignment parameter attributes for
memcpy/memmove/memset. ( https://reviews.llvm.org/rL322965, https://reviews.llvm.org/rC322964, https://reviews.llvm.org/rL322963 )
Step 2) Expand the IRBuilder API to allow creation of memcpy/memmove with differing
source and dest alignments. ( https://reviews.llvm.org/rL323597 )
Step 3) Update Clang to use the new IRBuilder API. ( https://reviews.llvm.org/rC323617 )
Step 4) Update Polly to use the new IRBuilder API. ( https://reviews.llvm.org/rL323618 )
Step 5) Update LLVM passes that create memcpy/memmove calls to use the new IRBuilder API,
and those that use use MemIntrinsicInst::[get|set]Alignment() to use [get|set]DestAlignment()
and [get|set]SourceAlignment() instead. ( https://reviews.llvm.org/rL323886, r323891 )
Step 6) Remove the single-alignment IRBuilder API for memcpy/memmove, and the
MemIntrinsicInst::[get|set]Alignment() methods.

Reference

  http://lists.llvm.org/pipermail/llvm-dev/2015-August/089384.html
  http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20151109/312083.html


Repository:
  rL LLVM

https://reviews.llvm.org/D42815

Files:
  lib/Target/AArch64/AArch64FastISel.cpp


Index: lib/Target/AArch64/AArch64FastISel.cpp
===================================================================
--- lib/Target/AArch64/AArch64FastISel.cpp
+++ lib/Target/AArch64/AArch64FastISel.cpp
@@ -3270,6 +3270,8 @@
     return Len < 32;
 }
 
+// FIXME: MemCpy intrinsic now provides separate alignments for source and
+// dest. Enhance this function to exploit this.
 bool AArch64FastISel::tryEmitSmallMemCpy(Address Dest, Address Src,
                                          uint64_t Len, unsigned Alignment) {
   // Make sure we don't bloat code by inlining very large memcpy's.
@@ -3457,7 +3459,8 @@
       // Small memcpy's are common enough that we want to do them without a call
       // if possible.
       uint64_t Len = cast<ConstantInt>(MTI->getLength())->getZExtValue();
-      unsigned Alignment = MTI->getAlignment();
+      unsigned Alignment = MinAlign(MTI->getDestAlignment(),
+                                    MTI->getSourceAlignment());
       if (isMemCpySmall(Len, Alignment)) {
         Address Dest, Src;
         if (!computeAddress(MTI->getRawDest(), Dest) ||


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D42815.132470.patch
Type: text/x-patch
Size: 1097 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180201/722f5571/attachment.bin>


More information about the llvm-commits mailing list