Cranelift: mark post-legalization trapping blocks as cold (#5367)

Trapping is a rare event.
This commit is contained in:
Nick Fitzgerald
2022-12-01 12:46:26 -08:00
committed by GitHub
parent 1eeec7b698
commit 4510a4a805
2 changed files with 43 additions and 0 deletions

View File

@@ -304,6 +304,9 @@ fn expand_cond_trap(
let new_block_trap = func.dfg.make_block();
let new_block_resume = func.dfg.make_block();
// Trapping is a rare event, mark the trapping block as cold.
func.layout.set_cold(new_block_trap);
// Replace trap instruction by the inverted condition.
if trapz {
func.dfg.replace(inst).brnz(arg, new_block_resume, &[]);