[all-commits] [llvm/llvm-project] 684ca0: [libc][__support] Ensure index_to_min_size monoton...

Schrodinger ZHU Yifan via All-commits all-commits at lists.llvm.org
Fri Jul 31 10:39:48 PDT 2026


  Branch: refs/heads/users/schrodingerzhu/libc-use-tlsf-freestore
  Home:   https://github.com/llvm/llvm-project
  Commit: 684ca0288c43203097ea60532e478d649600b809
      https://github.com/llvm/llvm-project/commit/684ca0288c43203097ea60532e478d649600b809
  Author: Yifan Zhu <yfzhu at google.com>
  Date:   2026-07-31 (Fri, 31 Jul 2026)

  Changed paths:
    M libc/src/__support/freestore.h

  Log Message:
  -----------
  [libc][__support] Ensure index_to_min_size monotonicity on MSVC Windows in TLSFFreeStoreImpl

On Windows MSVC where alignof(max_align_t) == 8, UNIT_SIZE is 8 while MIN_INNER_SIZE is 24 (3 * UNIT_SIZE).
In index_to_min_size, computing MIN_INNER_SIZE + (index - 1) * UNIT_SIZE + 1 for linear bins caused
index 31 (EXP_BASE - 1) to reach 265 bytes, exceeding the start of the exponential table at index EXP_BASE (32 * 8 = 256 bytes).
This caused IndexToMinSize unit test to fail EXPECT_GT(min_size, prev_size) at index 32.

This change caps min_size for linear bins at (EXP_BASE << UNIT_SIZE_LOG2) - (EXP_BASE - index),
ensuring index_to_min_size is strictly increasing across all indices on all targets.

TAG=agy
CONV=cff84e8c-ee22-4f39-af3c-344d1e6f417b



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list