[llvm] [CodeGen] Compact cost table entries (PR #202836)

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 3 02:51:00 PDT 2026


================
@@ -17,24 +17,27 @@
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/CodeGenTypes/MachineValueType.h"
+#include <cstdint>
 
 namespace llvm {
 
 /// Cost Table Entry
-template <typename CostType>
-struct CostTblEntryT {
-  int ISD;
-  MVT::SimpleValueType Type;
+template <typename CostType> struct CostTblEntryT {
+  // Cost tables use aggregate initialization, so values that do not fit in
+  // these fields are rejected as narrowing conversions at compile time.
+  uint16_t ISD;
+  uint8_t Type;
----------------
RKSimon wrote:

I'm not certain, but I thought MVT had already gone over 255 entries? MVT::SimpleValueType is a uint16_t

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


More information about the llvm-commits mailing list