Skip to content

Commit 3489ba3

Browse files
committed
Remove support for reentrant start blocks from codegen
The start block is guaranteed not to have any basic block predecessors.
1 parent 4d614e1 commit 3489ba3

File tree

1 file changed

+5
-19
lines changed
  • compiler/rustc_codegen_ssa/src/mir

1 file changed

+5
-19
lines changed

compiler/rustc_codegen_ssa/src/mir/mod.rs

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -152,20 +152,11 @@ pub fn codegen_mir<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
152152
}
153153

154154
let cleanup_kinds = analyze::cleanup_kinds(&mir);
155-
// Allocate a `Block` for every basic block, except
156-
// the start block, if nothing loops back to it.
157-
let reentrant_start_block = !mir.predecessors()[mir::START_BLOCK].is_empty();
158-
let cached_llbbs: IndexVec<mir::BasicBlock, Option<Bx::BasicBlock>> =
159-
mir.basic_blocks()
160-
.indices()
161-
.map(|bb| {
162-
if bb == mir::START_BLOCK && !reentrant_start_block {
163-
Some(start_llbb)
164-
} else {
165-
None
166-
}
167-
})
168-
.collect();
155+
let cached_llbbs: IndexVec<mir::BasicBlock, Option<Bx::BasicBlock>> = mir
156+
.basic_blocks()
157+
.indices()
158+
.map(|bb| if bb == mir::START_BLOCK { Some(start_llbb) } else { None })
159+
.collect();
169160

170161
let mut fx = FunctionCx {
171162
instance,
@@ -247,11 +238,6 @@ pub fn codegen_mir<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
247238
// Apply debuginfo to the newly allocated locals.
248239
fx.debug_introduce_locals(&mut bx);
249240

250-
// Branch to the START block, if it's not the entry block.
251-
if reentrant_start_block {
252-
bx.br(fx.llbb(mir::START_BLOCK));
253-
}
254-
255241
// Codegen the body of each block using reverse postorder
256242
// FIXME(eddyb) reuse RPO iterator between `analysis` and this.
257243
for (bb, _) in traversal::reverse_postorder(&mir) {

0 commit comments

Comments
 (0)