[llvm] [RISCV] Sink vp.splat operands of VP intrinsic. (PR #133245)
Min-Yih Hsu via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 28 10:21:28 PDT 2025
================
@@ -2772,6 +2772,40 @@ bool RISCVTTIImpl::canSplatOperand(Instruction *I, int Operand) const {
}
}
+bool RISCVTTIImpl::tryToSinkVPSplat(VPIntrinsic *VPI,
+ SmallVectorImpl<Use *> &Ops) const {
+ Value *EVL = VPI->getVectorLengthParam();
+ if (!EVL)
+ return false;
+
+ for (auto &Op : VPI->operands()) {
+ auto *I = dyn_cast<Instruction>(Op.get());
+ if (!I || I->getParent() == VPI->getParent() ||
+ llvm::is_contained(Ops, &Op))
+ continue;
+
+ // We are looking for a vp.splat that can be sunk.
+ if (!match(I, m_Intrinsic<Intrinsic::experimental_vp_splat>(
+ m_Value(), m_AllOnes(), m_Specific(EVL))))
----------------
mshockwave wrote:
I understand that vp.splat is most likely to be all ones, I'm just a little concerned (and maybe playing devil's advocate here) that we might miss some optimizations opportunities. But please don't let me block this patch.
https://github.com/llvm/llvm-project/pull/133245
More information about the llvm-commits
mailing list