[llvm] d4dc036 - [RISCV] Move vector cost table lookup out of the switch in getIntrinsicInstrCost. NFC
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 24 20:42:28 PDT 2022
Author: Craig Topper
Date: 2022-10-24T20:32:22-07:00
New Revision: d4dc036e70330ac205a65e4cfbc82cc1dfeda3e8
URL: https://github.com/llvm/llvm-project/commit/d4dc036e70330ac205a65e4cfbc82cc1dfeda3e8
DIFF: https://github.com/llvm/llvm-project/commit/d4dc036e70330ac205a65e4cfbc82cc1dfeda3e8.diff
LOG: [RISCV] Move vector cost table lookup out of the switch in getIntrinsicInstrCost. NFC
This allows vectors to be looked up if the switch is used for the
scalar version of an intrinsic.
Extracted from D136508.
Added:
Modified:
llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp b/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
index 64d214b611b0..f36443600ab2 100644
--- a/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
+++ b/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
@@ -511,15 +511,15 @@ RISCVTTIImpl::getIntrinsicInstrCost(const IntrinsicCostAttributes &ICA,
auto LT = getTypeLegalizationCost(RetTy);
return Cost + (LT.first - 1);
}
- default:
- if (ST->hasVInstructions() && RetTy->isVectorTy()) {
- auto LT = getTypeLegalizationCost(RetTy);
- if (const auto *Entry = CostTableLookup(VectorIntrinsicCostTable,
- ICA.getID(), LT.second))
- return LT.first * Entry->Cost;
- }
- break;
}
+
+ if (ST->hasVInstructions() && RetTy->isVectorTy()) {
+ auto LT = getTypeLegalizationCost(RetTy);
+ if (const auto *Entry = CostTableLookup(VectorIntrinsicCostTable,
+ ICA.getID(), LT.second))
+ return LT.first * Entry->Cost;
+ }
+
return BaseT::getIntrinsicInstrCost(ICA, CostKind);
}
More information about the llvm-commits
mailing list