]> git.lizzy.rs Git - rust.git/commit
Merge basic blocks where possible when generating LLVM IR.
authorNicholas Nethercote <n.nethercote@gmail.com>
Sun, 16 Oct 2022 21:29:40 +0000 (08:29 +1100)
committerNicholas Nethercote <n.nethercote@gmail.com>
Wed, 16 Nov 2022 04:46:39 +0000 (15:46 +1100)
commit54082dd21695373b770bd11e042e564396598c2a
tree9570a6265d93a4b6d7b147600b9a8ecc8fa38073
parent68194aa8d5c513fad53147e46144684f14f99463
Merge basic blocks where possible when generating LLVM IR.

In `codegen_assert_terminator` we decide if a BB's successor is a
candidate for merging, which requires that it be the only successor, and
that it only have one predecessor. That result then gets passed down,
and if it reaches `funclet_br` with the appropriate BB characteristics,
then no `br` instruction is issued, a `MergingSucc::True` result is
passed back, and the merging proceeds in `codegen_block`.

The commit also adds `CachedLlbb`, a new type to help keep track of
each BB that has been merged into its predecessor.
compiler/rustc_codegen_ssa/src/lib.rs
compiler/rustc_codegen_ssa/src/mir/block.rs
compiler/rustc_codegen_ssa/src/mir/mod.rs
src/test/debuginfo/lexical-scope-in-if-let.rs