[Mlir-commits] [mlir] [mlir] Bump SmallVector sizes along hot paths (PR #188827)

Krzysztof Drewniak llvmlistbot at llvm.org
Thu Mar 26 12:47:16 PDT 2026


================
@@ -415,7 +417,9 @@ class ValueBoundsConstraintSet
   void projectOutAnonymous(std::optional<int64_t> except = std::nullopt);
 
   /// Mapping of columns to values/shape dimensions.
-  SmallVector<std::optional<ValueDim>> positionToValueDim;
+  // Inline size chosen empirically based on compilation profiling.
+  // Profiled: 2.1M calls, avg=3.0+-1.9. N=4 covers ~70% of cases inline.
+  SmallVector<std::optional<ValueDim>, 4> positionToValueDim;
   /// Reverse mapping of values/shape dimensions to columns.
   DenseMap<ValueDim, int64_t> valueDimToPosition;
----------------
krzysz00 wrote:

I wonder if that finding means this should be a `SmallDenseMap` as well

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


More information about the Mlir-commits mailing list