aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm-project/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2024-04-05 22:02:56 +0000
committerDimitry Andric <dim@FreeBSD.org>2024-04-06 20:14:34 +0000
commit439352ac8257c8419cb4a662abb7f260f31f9932 (patch)
tree237d14d3439cac4b76d8a396fa37bc7470622e00 /contrib/llvm-project/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
parent49a6e426df84eff1ae54905a02f66910a6a177d3 (diff)
parent05834cae71b93c867532aee91cb7cab176920c01 (diff)
Diffstat (limited to 'contrib/llvm-project/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp')
-rw-r--r--contrib/llvm-project/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/contrib/llvm-project/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp b/contrib/llvm-project/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
index 866d5cf340e6..66dab70d455f 100644
--- a/contrib/llvm-project/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
+++ b/contrib/llvm-project/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
@@ -37,6 +37,9 @@ static cl::opt<unsigned> SLPMaxVF(
InstructionCost
RISCVTTIImpl::getRISCVInstructionCost(ArrayRef<unsigned> OpCodes, MVT VT,
TTI::TargetCostKind CostKind) {
+ // Check if the type is valid for all CostKind
+ if (!VT.isVector())
+ return InstructionCost::getInvalid();
size_t NumInstr = OpCodes.size();
if (CostKind == TTI::TCK_CodeSize)
return NumInstr;