Skip to content

Commit 16067fd

Browse files
committed
Mark blocks as cold in a couple more places
1 parent 47a7e99 commit 16067fd

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/base.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,6 @@ fn codegen_fn_body(fx: &mut FunctionCx<'_, '_, '_>, start_block: Block) {
379379

380380
let target = fx.get_block(*target);
381381
let failure = fx.bcx.create_block();
382-
fx.bcx.set_cold_block(failure);
383382

384383
if *expected {
385384
fx.bcx.ins().brif(cond, target, &[], failure, &[]);
@@ -544,6 +543,7 @@ fn codegen_fn_body(fx: &mut FunctionCx<'_, '_, '_>, start_block: Block) {
544543
fx.bcx.ins().trap(TrapCode::UnreachableCodeReached);
545544
}
546545
TerminatorKind::Unreachable => {
546+
fx.bcx.set_cold_block(block);
547547
fx.bcx.ins().trap(TrapCode::UnreachableCodeReached);
548548
}
549549
TerminatorKind::Yield { .. }
@@ -1075,6 +1075,8 @@ fn codegen_panic_inner<'tcx>(
10751075
args: &[Value],
10761076
span: Option<Span>,
10771077
) {
1078+
fx.bcx.set_cold_block(fx.bcx.current_block().unwrap());
1079+
10781080
let def_id = fx.tcx.require_lang_item(lang_item, span);
10791081

10801082
let instance = Instance::mono(fx.tcx, def_id).polymorphize(fx.tcx);

src/intrinsics/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
449449

450450
match intrinsic {
451451
sym::abort => {
452+
fx.bcx.set_cold_block(fx.bcx.current_block().unwrap());
452453
fx.bcx.ins().trap(TrapCode::User(0));
453454
return Ok(());
454455
}

0 commit comments

Comments
 (0)