[llvm] [IR] Allow non-constant offsets in @llvm.vector.splice.{left,right} (PR #174693)
Luke Lau via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 6 23:53:23 PST 2026
================
@@ -12029,27 +12030,20 @@ SDValue TargetLowering::expandVectorSplice(SDNode *Node,
SDValue StackPtr2 = DAG.getNode(ISD::ADD, DL, PtrVT, StackPtr, VTBytes);
SDValue StoreV2 = DAG.getStore(StoreV1, DL, V2, StackPtr2, PtrInfo);
- if (Node->getOpcode() == ISD::VECTOR_SPLICE_LEFT) {
- // Load back the required element. getVectorElementPointer takes care of
- // clamping the index if it's out-of-bounds.
- StackPtr = getVectorElementPointer(DAG, StackPtr, VT, Node->getOperand(2));
- // Load the spliced result
- return DAG.getLoad(VT, DL, StoreV2, StackPtr,
- MachinePointerInfo::getUnknownStack(MF));
- }
-
- // NOTE: TrailingElts must be clamped so as not to read outside of V1:V2.
- TypeSize EltByteSize = VT.getVectorElementType().getStoreSize();
- SDValue TrailingBytes = DAG.getConstant(Imm * EltByteSize, DL, PtrVT);
+ // NOTE: TrailingBytes must be clamped so as not to read outside of V1:V2.
+ SDValue EltByteSize =
+ DAG.getTypeSize(DL, PtrVT, VT.getVectorElementType().getStoreSize());
+ SDValue TrailingBytes = DAG.getNode(ISD::MUL, DL, PtrVT, Offset, EltByteSize);
----------------
lukel97 wrote:
Added an extend in b5c7edd4afc505a27f38070d3c40742709aa2e0c, I think it just happened to work beforehand because Offset is cast to getVectorIdxTy in SelectionDAGBuilder
https://github.com/llvm/llvm-project/pull/174693
More information about the llvm-commits
mailing list