Skip to content

Commit f2d9579

Browse files
authored
Rollup merge of rust-lang#76262 - howard0su:patch-1, r=cramertj
Use inline(never) instead of cold inline(never) is better way to avoid optimizer to inline the function instead of cold.
2 parents fe989e9 + a80d390 commit f2d9579

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

library/std/src/thread/local.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -424,10 +424,9 @@ pub mod fast {
424424
// thread_local's, or it is being recursively initialized.
425425
//
426426
// Macos: Inlining this function can cause two `tlv_get_addr` calls to
427-
// be performed for every call to `Key::get`. The #[cold] hint makes
428-
// that less likely.
427+
// be performed for every call to `Key::get`.
429428
// LLVM issue: https://bugs.llvm.org/show_bug.cgi?id=41722
430-
#[cold]
429+
#[inline(never)]
431430
unsafe fn try_initialize<F: FnOnce() -> T>(&self, init: F) -> Option<&'static T> {
432431
if !mem::needs_drop::<T>() || self.try_register_dtor() {
433432
Some(self.inner.initialize(init))

0 commit comments

Comments
 (0)