[RISCV] Move vector cost table lookup out of the switch in getIntrinsicInstrCost...
authorCraig Topper <craig.topper@sifive.com>
Tue, 25 Oct 2022 03:30:54 +0000 (20:30 -0700)
committerCraig Topper <craig.topper@sifive.com>
Tue, 25 Oct 2022 03:32:22 +0000 (20:32 -0700)
This allows vectors to be looked up if the switch is used for the
scalar version of an intrinsic.

Extracted from D136508.

llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp

index 64d214b..f364436 100644 (file)
@@ -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);
 }