[llvm] [RISCV] Sink vp.splat operands of VP intrinsic. (PR #133245)

via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 14 19:58:42 PDT 2025


================
@@ -2837,39 +2837,43 @@ bool RISCVTTIImpl::isProfitableToSinkOperands(
   if (!ST->sinkSplatOperands())
     return false;
 
-  for (auto OpIdx : enumerate(I->operands())) {
-    if (!canSplatOperand(I, OpIdx.index()))
-      continue;
-
-    Instruction *Op = dyn_cast<Instruction>(OpIdx.value().get());
+  for (auto &U : I->operands()) {
+    auto *Op = dyn_cast<Instruction>(U.get());
     // Make sure we are not already sinking this operand
     if (!Op || any_of(Ops, [&](Use *U) { return U->get() == Op; }))
       continue;
 
-    // We are looking for a splat that can be sunk.
-    if (!match(Op, m_Shuffle(m_InsertElt(m_Undef(), m_Value(), m_ZeroInt()),
+    // We are looking for a splat/vp.splat that can be sunk.
+    // FIXME: Should we care about the poison value of inactive elements in
+    // vp.splat?
----------------
NexMing wrote:

Alright.

https://github.com/llvm/llvm-project/pull/133245


More information about the llvm-commits mailing list