Skip to content

Commit b712950

Browse files
author
Ariel Ben-Yehuda
authored
Rollup merge of rust-lang#41015 - arielb1:new-block-stack, r=alexcrichton
mark build::cfg::start_new_block as inline(never) LLVM has a bug - [PR32488](https://bugs.llvm.org//show_bug.cgi?id=32488) - where it fails to deduplicate allocas in some circumstances. The function `start_new_block` has allocas totalling 1216 bytes, and when LLVM inlines several copies of that function into the recursive function `expr::into`, that function's stack space usage goes into tens of kiBs, causing stack overflows. Mark `start_new_block` as inline(never) to keep it from being inlined, getting stack usage under control. Fixes rust-lang#40493. Fixes rust-lang#40573. r? @eddyb
2 parents 9d07447 + 09ac56d commit b712950

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/librustc_mir/build/cfg.rs

+3
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ impl<'tcx> CFG<'tcx> {
2525
&mut self.basic_blocks[blk]
2626
}
2727

28+
// llvm.org/PR32488 makes this function use an excess of stack space. Mark
29+
// it as #[inline(never)] to keep rustc's stack use in check.
30+
#[inline(never)]
2831
pub fn start_new_block(&mut self) -> BasicBlock {
2932
self.basic_blocks.push(BasicBlockData::new(None))
3033
}

0 commit comments

Comments
 (0)