mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-05-08 10:47:28 +03:00
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:
parent
314c073a38
commit
36ca0c1b7d
1 changed files with 1 additions and 1 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue