Stop concealing pointer provenance in phn_link_get

At least for LLVM, [casting from an integer to a pointer hides provenance information](https://clang.llvm.org/extra/clang-tidy/checks/performance/no-int-to-ptr.html)
and inhibits optimizations. Here's a [Godbolt link](https://godbolt.org/z/5bYPcKoWT)
showing how this change removes a couple unnecessary branches in
`phn_merge_siblings`, which is a very hot function. Canary profiles show
only minor improvements (since most of the cost of this function is in
cache misses), but there's no reason we shouldn't take it.
This commit is contained in:
Kevin Svetlitski 2023-07-12 09:57:46 -07:00 committed by Qi Wang
parent 314c073a38
commit 36ca0c1b7d

View File

@ -73,7 +73,7 @@ struct ph_s {
JEMALLOC_ALWAYS_INLINE phn_link_t *
phn_link_get(void *phn, size_t offset) {
return (phn_link_t *)(((uintptr_t)phn) + offset);
return (phn_link_t *)(((char *)phn) + offset);
}
JEMALLOC_ALWAYS_INLINE void