Auto merge of #27221 - dotdash:no_empty_clean, r=luqmana
When compiling libsyntax this removes about 30k basic blocks that only contain a single unconditional jump and reduces the peak memory usage by about 10MB (from 681MB down to 671MB).
This commit is contained in:
commit
7911d9979f
1 changed files with 15 additions and 13 deletions
|
@ -774,20 +774,22 @@ impl<'blk, 'tcx> CleanupHelperMethods<'blk, 'tcx> for FunctionContext<'blk, 'tcx
|
|||
// At this point, `popped_scopes` is empty, and so the final block
|
||||
// that we return to the user is `Cleanup(AST 24)`.
|
||||
while let Some(mut scope) = popped_scopes.pop() {
|
||||
let name = scope.block_name("clean");
|
||||
debug!("generating cleanups for {}", name);
|
||||
let bcx_in = self.new_block(label.is_unwind(),
|
||||
&name[..],
|
||||
None);
|
||||
let mut bcx_out = bcx_in;
|
||||
for cleanup in scope.cleanups.iter().rev() {
|
||||
bcx_out = cleanup.trans(bcx_out,
|
||||
scope.debug_loc);
|
||||
}
|
||||
build::Br(bcx_out, prev_llbb, DebugLoc::None);
|
||||
prev_llbb = bcx_in.llbb;
|
||||
if !scope.cleanups.is_empty() {
|
||||
let name = scope.block_name("clean");
|
||||
debug!("generating cleanups for {}", name);
|
||||
let bcx_in = self.new_block(label.is_unwind(),
|
||||
&name[..],
|
||||
None);
|
||||
let mut bcx_out = bcx_in;
|
||||
for cleanup in scope.cleanups.iter().rev() {
|
||||
bcx_out = cleanup.trans(bcx_out,
|
||||
scope.debug_loc);
|
||||
}
|
||||
build::Br(bcx_out, prev_llbb, DebugLoc::None);
|
||||
prev_llbb = bcx_in.llbb;
|
||||
|
||||
scope.add_cached_early_exit(label, prev_llbb);
|
||||
scope.add_cached_early_exit(label, prev_llbb);
|
||||
}
|
||||
self.push_scope(scope);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue