[llvm-branch-commits] [llvm] [SLP] Pass a lane as the vector cost context only if all lanes agree (PR #241758)

via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu Nov 12 04:53:40 PST 2026


================
@@ -16676,6 +16676,26 @@ static std::optional<unsigned> getCastOpcodeForDemotedOperand(unsigned Opcode,
   }
 }
 
+/// Returns \p Cost with \p Repr as the context if every lane of \p VL that
+/// \p Repr represents gives the same cost as its context, and \p Cost without
+/// a context otherwise.
+static InstructionCost getCostInAgreedContext(
----------------
michaelselehov wrote:

Thanks, I will move the decision into TTI. One question about the shape. I can add the scalars as a parameter of getArithmeticInstrCost, like getAltInstrCost has, which changes the signature in every target. Or I can add a separate hook with a default implementation, so only TTI, AMDGPU and SLP change. Which one do you prefer?

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


More information about the llvm-branch-commits mailing list