Skip to content

Commit

Permalink
Rollup merge of rust-lang#108739 - 823984418:patch-1, r=cjgillot
Browse files Browse the repository at this point in the history
Prevent the `start_bx` basic block in codegen from having two `Builder`s at the same time

Here, at the same time, there are two `start_llbb` builder, this should be unexpected.
  • Loading branch information
matthiaskrgr authored Mar 9, 2023
2 parents 80e1112 + 871b4fe commit ebfe8ac
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions compiler/rustc_codegen_ssa/src/mir/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,10 @@ pub fn codegen_mir<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
// Apply debuginfo to the newly allocated locals.
fx.debug_introduce_locals(&mut start_bx);

// The builders will be created separately for each basic block at `codegen_block`.
// So drop the builder of `start_llbb` to avoid having two at the same time.
drop(start_bx);

// Codegen the body of each block using reverse postorder
for (bb, _) in traversal::reverse_postorder(&mir) {
fx.codegen_block(bb);
Expand Down

0 comments on commit ebfe8ac

Please sign in to comment.