[PATCH] D21935: Add TLI.allowsMisalignedMemoryAccesses to LoadStoreVectorizer

Alina Sbirlea via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 8 13:36:21 PDT 2016


asbirlea added inline comments.

================
Comment at: include/llvm/Analysis/TargetTransformInfo.h:391
@@ -390,1 +390,3 @@
 
+  /// \brief Indicate whether target allows misaligned memory accesses
+  bool allowsMisalignedMemoryAccesses(unsigned BitWidth, unsigned AddressSpace = 0,
----------------
jlebar wrote:
> sgtm
done.

================
Comment at: lib/Transforms/Vectorize/LoadStoreVectorizer.cpp:702
@@ -697,2 +701,3 @@
+      (Alignment % SzInBytes) != 0 && (Alignment % TargetBaseAlign) != 0) {
     if (S0->getPointerAddressSpace() == 0) {
       // If we're storing to an object on the stack, we control its alignment,
----------------
jlebar wrote:
> I still think it might make sense to move the (Alignment % SzInBytes) != 0 && (Alignment % TargetBaseAlign) != 0 checks into the helper function (currently called allowsMisalignedAndIsFast, would need a new name).  But, up to you.
I debated a bit whether to do this. Ideally I would have liked a single point of usage (and future removal) for TargetBaseAlign. Still, the condition is cleaner and I can remove a nesting level.


http://reviews.llvm.org/D21935





More information about the llvm-commits mailing list