[PATCH] D93229: [VectorCombine] allow peeking through GEPs when creating a vector load

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 17 12:09:13 PST 2020


lebedev.ri added inline comments.


================
Comment at: llvm/lib/Transforms/Vectorize/VectorCombine.cpp:155-156
+    SrcPtr = SrcPtr->stripAndAccumulateInBoundsConstantOffsets(DL, Offset);
+    if (!isSafeToLoadUnconditionally(SrcPtr, MinVecTy, Align(1), DL, Load, &DT))
+      return false;
+
----------------
I think this should be done later, after cheaper checks.


================
Comment at: llvm/lib/Transforms/Vectorize/VectorCombine.cpp:168-170
+    // The offset must be within a vector-length to allow shuffling into place.
+    if (!Offset.ult(MinVectorSize / 8))
+      return false;
----------------
We want to load a single element of X bytes,
by instead loading Y such elements at once.
We've dissected the pointer into a base pointer, and a byte offset.
We know that the byte offset is a multiple of element size.
We need to ensure that if we load Y elements from the base pointer,
we still load the element we are after.
I think approaching that check from byte count is highly confusing.
(at least i already spent too much time trying to check this)
Let's do a much more obvious, element count based check.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D93229/new/

https://reviews.llvm.org/D93229



More information about the llvm-commits mailing list