Remove support for reentrant start blocks from codegen
The start block is guaranteed not to have any basic block predecessors.
This commit is contained in:
parent
4d614e1d1f
commit
3489ba3bbb
1 changed files with 5 additions and 19 deletions
|
@ -152,19 +152,10 @@ pub fn codegen_mir<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
|
||||||
}
|
}
|
||||||
|
|
||||||
let cleanup_kinds = analyze::cleanup_kinds(&mir);
|
let cleanup_kinds = analyze::cleanup_kinds(&mir);
|
||||||
// Allocate a `Block` for every basic block, except
|
let cached_llbbs: IndexVec<mir::BasicBlock, Option<Bx::BasicBlock>> = mir
|
||||||
// the start block, if nothing loops back to it.
|
.basic_blocks()
|
||||||
let reentrant_start_block = !mir.predecessors()[mir::START_BLOCK].is_empty();
|
|
||||||
let cached_llbbs: IndexVec<mir::BasicBlock, Option<Bx::BasicBlock>> =
|
|
||||||
mir.basic_blocks()
|
|
||||||
.indices()
|
.indices()
|
||||||
.map(|bb| {
|
.map(|bb| if bb == mir::START_BLOCK { Some(start_llbb) } else { None })
|
||||||
if bb == mir::START_BLOCK && !reentrant_start_block {
|
|
||||||
Some(start_llbb)
|
|
||||||
} else {
|
|
||||||
None
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
let mut fx = FunctionCx {
|
let mut fx = FunctionCx {
|
||||||
|
@ -247,11 +238,6 @@ pub fn codegen_mir<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
|
||||||
// Apply debuginfo to the newly allocated locals.
|
// Apply debuginfo to the newly allocated locals.
|
||||||
fx.debug_introduce_locals(&mut bx);
|
fx.debug_introduce_locals(&mut bx);
|
||||||
|
|
||||||
// Branch to the START block, if it's not the entry block.
|
|
||||||
if reentrant_start_block {
|
|
||||||
bx.br(fx.llbb(mir::START_BLOCK));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Codegen the body of each block using reverse postorder
|
// Codegen the body of each block using reverse postorder
|
||||||
// FIXME(eddyb) reuse RPO iterator between `analysis` and this.
|
// FIXME(eddyb) reuse RPO iterator between `analysis` and this.
|
||||||
for (bb, _) in traversal::reverse_postorder(&mir) {
|
for (bb, _) in traversal::reverse_postorder(&mir) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue