[llvm] [TTI][RISCV]Improve costs for whole vector reg extract/insert. (PR #80164)

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 8 02:58:44 PST 2024


================
@@ -457,12 +457,28 @@ InstructionCost RISCVTTIImpl::getShuffleCost(TTI::ShuffleKind Kind,
     // vslidedown.vi  v8, v9, 2
     return LT.first *
            getRISCVInstructionCost(RISCV::VSLIDEDOWN_VI, LT.second, CostKind);
-  case TTI::SK_InsertSubvector:
+  case TTI::SK_InsertSubvector: {
+    if (Index == 0 && !Args.empty() && any_of(Args, UndefValue::classof))
+      return TTI::TCC_Free;
+    const unsigned MinVLen = ST->getRealMinVLen();
+    const unsigned MaxVLen = ST->getRealMaxVLen();
----------------
lukel97 wrote:

You can use `ST->getRealVLen()` which was added recently

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


More information about the llvm-commits mailing list