[llvm] [RISCV][CostModel] Estimate cost of Extract/InsertElement with non-constant index when vector instructions are not available (PR #67334)

Sergey Kachkov via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 26 09:48:03 PDT 2023


================
@@ -1460,8 +1460,29 @@ InstructionCost RISCVTTIImpl::getVectorInstrCost(unsigned Opcode, Type *Val,
   std::pair<InstructionCost, MVT> LT = getTypeLegalizationCost(Val);
 
   // This type is legalized to a scalar type.
-  if (!LT.second.isVector())
-    return 0;
+  if (!LT.second.isVector()) {
+    auto *FixedVecTy = dyn_cast<FixedVectorType>(Val);
+    // Scalable vectors can't be legalized with scalars, return invalid cost.
+    if (!FixedVecTy)
----------------
skachkov-sc wrote:

Yes, the condition below handles it, removed this

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


More information about the llvm-commits mailing list