[llvm] [StackSlotColoring] Add size aware stack slot coloring with TTI hook (PR #181874)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 17 09:53:26 PDT 2026


================
@@ -111,6 +111,11 @@ class LLVM_ABI TargetFrameLowering {
   ///
   virtual uint64_t getStackThreshold() const { return UINT_MAX; }
 
+  /// Return a positive scale to incorporate stack slot size into coloring
+  /// weight (weight += scale * size). When 0, only use-based weight is used;
+  /// when positive, the target also uses best-fit allocation.
+  virtual float getStackSlotColoringSizeWeightScale() const { return 0.0f; }
----------------
arsenm wrote:

This isn't TTI 

This also smells like a hook that only exists to not touch other target tests. There's no principled way to pick this number, so if it needs to exist, just hardcode one?

Can you just use BlockFrequencyInfo or something?

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


More information about the llvm-commits mailing list