Skip to content

Commit 4b800d3

Browse files
authored
[RISCV] Remove last use of @llvm.experimental.vp.splat in RISCVCodeGenPrepare. NFCI (#170543)
RISCVCodeGenPrepare is the last user of the vp.splat intrinsic, where it uses it to expand a zero strided load into a scalar load and splat. Originally this was to avoid vl toggles inside vectorized loops, but nowadays this shouldn't be necessary because we have RISCVVLOptimizer. To preserve the test cases where there's no store with VL, this replaces it with a regular splat followed by a vp_merge to set the lanes past EVL as poison. We need to set the EVL here because RISCVISelDAGToDAG will try and recombine it back into a zero strided load, and we want to preserve the original VL.
1 parent 8e39bcd commit 4b800d3

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

llvm/lib/Target/RISCV/RISCVCodeGenPrepare.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,8 +271,10 @@ bool RISCVCodeGenPrepare::expandVPStrideLoad(IntrinsicInst &II) {
271271
IRBuilder<> Builder(&II);
272272
Type *STy = VTy->getElementType();
273273
Value *Val = Builder.CreateLoad(STy, BasePtr);
274-
Value *Res = Builder.CreateIntrinsic(Intrinsic::experimental_vp_splat, {VTy},
275-
{Val, II.getOperand(2), VL});
274+
Value *Res = Builder.CreateIntrinsic(
275+
Intrinsic::vp_merge, VTy,
276+
{II.getOperand(2), Builder.CreateVectorSplat(VTy->getElementCount(), Val),
277+
PoisonValue::get(VTy), VL});
276278

277279
II.replaceAllUsesWith(Res);
278280
II.eraseFromParent();

0 commit comments

Comments
 (0)