[PATCH] D24271: [LV] Don't mark pointers used by scalarized memory accesses uniform

Matthew Simpson via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 7 11:55:45 PDT 2016


mssimpso added inline comments.

================
Comment at: lib/Transforms/Vectorize/LoopVectorize.cpp:5332-5334
@@ +5331,5 @@
+    return true;
+
+  // If the instruction's allocated type size doesn't equal it's stored type
+  // size, it requires padding and may be scalarized.
+  auto &DL = I->getModule()->getDataLayout();
----------------
mssimpso wrote:
> Oh I see. I think I was misinterpreting the difference between allocated size and store size. But aren't we really just wanting to know if there's padding been successive elements of a given type? That is, in your example if we have a <4 x i20>, we can't just store this type to memory without the 4 bits between each element.
> 
> What about DL.getTypeSizeInBits(ScalarType) != DL.getTypeAllocSizeInBits(ScalarType)? Using "type size" instead of "store size" should prevent rounding up to the next byte. For the i20 example, we would have 20 != 24, so the type is irregular.
> 
> What about DL.getTypeSizeInBits(ScalarType) != DL.getTypeAllocSizeInBits(ScalarType)?

After further digging, I think this is indeed equivalent to the existing code in vectorlizeMemoryInstruction. The reason is that DL.getTypeStoreSize(VectorType) is implemented as VF * DL.getTypeSizeInBits(ElementType) in DataLayout.h. So the VF's cancel. I'll update the patch accordingly.


https://reviews.llvm.org/D24271





More information about the llvm-commits mailing list