Skip to content

Commit a298c69

Browse files
committed
Mark extern rust-cold calls as cold
1 parent 875ffa1 commit a298c69

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/abi/mod.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -376,9 +376,15 @@ pub(crate) fn codegen_terminator_call<'tcx>(
376376
RevealAllLayoutCx(fx.tcx).fn_abi_of_fn_ptr(fn_ty.fn_sig(fx.tcx), extra_args)
377377
};
378378

379-
let is_cold = instance
380-
.map(|inst| fx.tcx.codegen_fn_attrs(inst.def_id()).flags.contains(CodegenFnAttrFlags::COLD))
381-
.unwrap_or(false);
379+
let is_cold = if fn_sig.abi == Abi::RustCold {
380+
true
381+
} else {
382+
instance
383+
.map(|inst| {
384+
fx.tcx.codegen_fn_attrs(inst.def_id()).flags.contains(CodegenFnAttrFlags::COLD)
385+
})
386+
.unwrap_or(false)
387+
};
382388
if is_cold {
383389
fx.bcx.set_cold_block(fx.bcx.current_block().unwrap());
384390
if let Some(destination_block) = target {

0 commit comments

Comments
 (0)