fn remap_to_last_target(
    mut remapping: BTreeMap<Label, Label>,
    start: Label,
    blocks: &mut BasicBlocks,
) {
    // The start block can't be relabelled in the current CFG API.
    // But it does not need to be since it will always be the first block, thus it will not run
    // into issues in the bytecode verifier
    remapping.remove(&start);
    if remapping.is_empty() {
        return;
    }
    // populate remapping for non changed blocks
    for label in blocks.keys() {
        remapping.entry(*label).or_insert(*label);
    }
    let owned_blocks = std::mem::take(blocks);
    let (_start, remapped_blocks) = remap_labels(&remapping, start, owned_blocks);
    *blocks = remapped_blocks;
}
/// In order to preserve loop invariants at the bytecode level, when a block is "inlined", that
/// block needs to be relabelled as the "inlined" block
/// Without this, blocks that were outside of loops could be inlined into the loop-body, breaking
/// invariants needed at the bytecode level.
/// For example:
/// Before:
///   A: block_a; jump B
///   B: block_b
///
///   s.t. A is the only one jumping to B
///
/// After:
///   B: block_a; block_b
In order to preserve loop invariants at the bytecode level, when a block is "inlined", that
block needs to be relabelled as the "inlined" block
Without this, blocks that were outside of loops could be inlined into the loop-body, breaking
invariants needed at the bytecode level.
For example:
Before:
A: block_a; jump B
B: block_b




In order to preserve loop invariants at the bytecode level when a block is " inlined " that block needs to be relabelled as the " inlined " block Without this blocks that were outside of loops could be inlined into the loop - body breaking invariants needed at the bytecode level . For example : Before : A : block_a ; jump B B : block_b
fn remap_to_last_target(
    mut remapping: BTreeMap<Label, Label>,
    start: Label,
    blocks: &mut BasicBlocks,
) {
    // The start block can't be relabelled in the current CFG API.
    // But it does not need to be since it will always be the first block, thus it will not run
    // into issues in the bytecode verifier
    remapping.remove(&start);
    if remapping.is_empty() {
        return;
    }
    // populate remapping for non changed blocks
    for label in blocks.keys() {
        remapping.entry(*label).or_insert(*label);
    }
    let owned_blocks = std::mem::take(blocks);
    let (_start, remapped_blocks) = remap_labels(&remapping, start, owned_blocks);
    *blocks = remapped_blocks;
}
fn remap_to_last_target ( mut remapping : BTreeMap < Label , Label > , start : Label , blocks : & mut BasicBlocks , ) { // The start block can't be relabelled in the current CFG API. // But it does not need to be since it will always be the first block, thus it will not run // into issues in the bytecode verifier remapping . remove ( & start ) ; if remapping . is_empty ( ) { return ; } // populate remapping for non changed blocks for label in blocks . keys ( ) { remapping . entry ( * label ) . or_insert ( * label ) ; } let owned_blocks = std :: mem :: take ( blocks ) ; let ( _start , remapped_blocks ) = remap_labels ( & remapping , start , owned_blocks ) ; * blocks = remapped_blocks ; }
In order to preserve loop invariants at the bytecode level, when a block is "inlined", that
block needs to be relabelled as the "inlined" block
Without this, blocks that were outside of loops could be inlined into the loop-body, breaking
invariants needed at the bytecode level.
In order to preserve loop invariants at the bytecode level when a block is " inlined " that block needs to be relabelled as the " inlined " block Without this blocks that were outside of loops could be inlined into the loop - body breaking invariants needed at the bytecode level .
remapping
BTreeMap<Label, Label>
start
Label
blocks
&mut BasicBlocks