[llvm] 4b800d3 - [RISCV] Remove last use of @llvm.experimental.vp.splat in RISCVCodeGenPrepare. NFCI (#170543)
via llvm-commits
llvm-commits at lists.llvm.org
Sun Dec 7 22:09:07 PST 2025
Author: Luke Lau
Date: 2025-12-08T06:09:03Z
New Revision: 4b800d309920889504ff04b57cb818a45b28d748
URL: https://github.com/llvm/llvm-project/commit/4b800d309920889504ff04b57cb818a45b28d748
DIFF: https://github.com/llvm/llvm-project/commit/4b800d309920889504ff04b57cb818a45b28d748.diff
LOG: [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.
Added:
Modified:
llvm/lib/Target/RISCV/RISCVCodeGenPrepare.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/RISCV/RISCVCodeGenPrepare.cpp b/llvm/lib/Target/RISCV/RISCVCodeGenPrepare.cpp
index ab450f9c4a61d..1ee4c66a5bde5 100644
--- a/llvm/lib/Target/RISCV/RISCVCodeGenPrepare.cpp
+++ b/llvm/lib/Target/RISCV/RISCVCodeGenPrepare.cpp
@@ -271,8 +271,10 @@ bool RISCVCodeGenPrepare::expandVPStrideLoad(IntrinsicInst &II) {
IRBuilder<> Builder(&II);
Type *STy = VTy->getElementType();
Value *Val = Builder.CreateLoad(STy, BasePtr);
- Value *Res = Builder.CreateIntrinsic(Intrinsic::experimental_vp_splat, {VTy},
- {Val, II.getOperand(2), VL});
+ Value *Res = Builder.CreateIntrinsic(
+ Intrinsic::vp_merge, VTy,
+ {II.getOperand(2), Builder.CreateVectorSplat(VTy->getElementCount(), Val),
+ PoisonValue::get(VTy), VL});
II.replaceAllUsesWith(Res);
II.eraseFromParent();
More information about the llvm-commits
mailing list