Always-inline SwissTable slot_array() accessors. Annotate CommonFields::slot_array() (both overloads), raw_hash_set_base::slot_array(), and raw_hash_set::slot_array() in raw_hash_set.h with ABSL_ATTRIBUTE_ALWAYS_INLINE. Flattening the slot_array() chain during AlwaysInlinerPass places `ABSL_ASSUME(capacity > kMaxSmallCapacity)` and `ctrl + NumControlBytesForLargeTable(capacity)` directly in lookup and insert callers before CGSCC simplifies HashtableCapacity::capacity() and probe(). That lets instruction combining and selection share the negated shift `-1ULL << c` already formed by shlxq for the probe mask to compute `ctrl + (1ULL << c) + 15` via subq and `addq $0xf`, eliminating the separate `andl $0x3f` + bzhiq + two addq sequence computed for `(1ULL << c) - 1`. PiperOrigin-RevId: 1014901887
diff --git a/absl/container/internal/raw_hash_set.h b/absl/container/internal/raw_hash_set.h index cc85cd1..b51d153 100644 --- a/absl/container/internal/raw_hash_set.h +++ b/absl/container/internal/raw_hash_set.h
@@ -1395,12 +1395,15 @@ // Note: we can't use `slots()` because Qt defines `slots` as a macro. // Note: we take `ctrl` as a parameter so that raw_hash_set can benefit from // the separate storage assumption. - void* slot_array(ctrl_t* ctrl, size_t capacity) const { + ABSL_ATTRIBUTE_ALWAYS_INLINE void* slot_array(ctrl_t* ctrl, + size_t capacity) const { ABSL_SWISSTABLE_ASSERT(ctrl == this->control()); ABSL_ASSUME(capacity > kMaxSmallCapacity); return ctrl + NumControlBytesForLargeTable(capacity); } - void* slot_array(size_t cap) const { return slot_array(control(), cap); } + ABSL_ATTRIBUTE_ALWAYS_INLINE void* slot_array(size_t cap) const { + return slot_array(control(), cap); + } // Returns pointer to the single slot of a table with capacity 1. void* single_non_soo_slot() const { ABSL_SWISSTABLE_ASSERT(capacity() == 1); @@ -2604,7 +2607,7 @@ } template <bool kIsDefaultAlloc> - void* slot_array(size_t capacity) const { + ABSL_ATTRIBUTE_ALWAYS_INLINE void* slot_array(size_t capacity) const { // Note: we don't use common().slot_array(capacity) here because it misses // the separate storage assumption in control(). return common().slot_array(control<kIsDefaultAlloc>(), capacity); @@ -4296,7 +4299,7 @@ ABSL_SWISSTABLE_ASSERT(!is_soo()); return raw_hash_set_base::control<kIsDefaultAlloc>(); } - slot_type* slot_array(size_t capacity) const { + ABSL_ATTRIBUTE_ALWAYS_INLINE slot_type* slot_array(size_t capacity) const { return to_slot(raw_hash_set_base::slot_array<kIsDefaultAlloc>(capacity)); } slot_type* soo_slot() {