[llvm] [DAG] Change `isExtractSubvectorCheap` into `getExtractSubvectorCost` (PR #213614)

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 3 00:57:47 PDT 2026


================
@@ -27777,7 +27777,7 @@ static SDValue narrowExtractedVectorBinOp(EVT VT, SDValue Src, unsigned Index,
   // bitcasted.
   unsigned ConcatOpNum = Index / VT.getVectorNumElements();
   unsigned ExtBOIdx = ConcatOpNum * NarrowBVT.getVectorNumElements();
-  if (TLI.isExtractSubvectorCheap(NarrowBVT, WideBVT, ExtBOIdx) &&
+  if ((TLI.getExtractSubvectorCost(NarrowBVT, WideBVT, ExtBOIdx) < 2) &&
----------------
lukel97 wrote:

Comparing by 2 seems pretty arbitrary. I think cheap in most of these targets refers to being free? At least on RISC-V. Can we just check that the cost is `TCC_Free`?

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


More information about the llvm-commits mailing list