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

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 14 10:13:01 PST 2020


spatel added inline comments.


================
Comment at: llvm/lib/Transforms/Vectorize/VectorCombine.cpp:147-149
+    APInt Offset(OffsetBitWidth, 0);
+    SrcPtr = SrcPtr->stripAndAccumulateInBoundsConstantOffsets(DL, Offset);
+    if (!isSafeToLoadUnconditionally(SrcPtr, MinVecTy, Alignment, DL, Load,
----------------
lebedev.ri wrote:
> I strongly suspect that you need to recalculate the `Alignment` here,
> because i don't think the `Offset`-less pointer is guaranteed to still be `Alignment`-aligned.
That's an interesting question. I think what we're doing here (even without this patch) is comparing the alignment of the original scalar load with the alignment of the pointer of a new vector load. But that's not very meaningful is it? For example, if we are loading an i16 with `align 2` then does it matter whether the original pointer is at least `align 2` for a load of v8i16?

I haven't looked at alignment requirements much. If there's another related transform that we can use as a template, let me know.


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

https://reviews.llvm.org/D93229



More information about the llvm-commits mailing list