[PATCH] D42974: [SROA] Take advantage of separate alignments for memcpy source and destination

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 12 14:57:17 PDT 2018


efriedma added inline comments.


================
Comment at: lib/Transforms/Scalar/SROA.cpp:2701
       II.setDest(getNewAllocaSlicePtr(IRB, OldPtr->getType()));
-      II.setAlignment(getSliceAlign());
+      II.setDestAlignment(getSliceAlign());
 
----------------
dneilson wrote:
> efriedma wrote:
> > Testcase?
> Any number of the memsets in tests/Transforms/SROA/basictest.ll act as a test for this. For example, the memset in test18 at line 783.
This isn't actually a functional change; nevermind.


================
Comment at: lib/Transforms/Scalar/SROA.cpp:2828
         II.setSource(AdjustedPtr);
-
-      if (II.getAlignment() > SliceAlign) {
-        II.setAlignment(MinAlign(II.getAlignment(), SliceAlign));
+        II.setSourceAlignment(SliceAlign);
       }
----------------
dneilson wrote:
> efriedma wrote:
> > Testcase?  (At least, at first glance it doesn't look like the memcpy tests cover this.)
> test18 -- the memcpy at line 798 tests the IsDest case
> test18 -- the memcpy at line 803 tests the !IsDest case
> 
> There are others as well; this is just a sampling.
Okay.  It would be nice to have a test which explicitly checks we preserve the alignment on the other operand.


Repository:
  rL LLVM

https://reviews.llvm.org/D42974





More information about the llvm-commits mailing list