[llvm] [NFC] Various Cleanup in StackColoring, StackSlotColoring, LiveStacks (PR #143931)

via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 22 23:29:19 PDT 2025


================
@@ -795,6 +795,49 @@ using stack_float_t = volatile float;
 using stack_float_t = float;
 #endif
 
+/// Returns the number of digits in the given integer.
+inline int NumDigits(uint64_t N) {
----------------
Ralender wrote:

This MR is really a stack of commit that could be interpreted separately.
its just getting moved from an other place in the codebase such that it can be explicitly used elsewhere.
log10 is not enough, you need `I != 0 ? log10(I) + 1 : 1` so `NumDigits` is much more explicit.
I pretty sure its much faster to do this than floating point log10.

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


More information about the llvm-commits mailing list