[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:40:13 PDT 2016


mssimpso added inline comments.

================
Comment at: lib/Transforms/Vectorize/LoopVectorize.cpp:5326
@@ +5325,3 @@
+  StoreInst *SI = dyn_cast<StoreInst>(I);
+  assert((LI || SI) && "Invalid memory instruction");
+
----------------
Ah, I see. Yes, I think we can move all of this into a single function.

================
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();
----------------
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.



https://reviews.llvm.org/D24271





More information about the llvm-commits mailing list