Auto merge of #33030 - nagisa:mir-unrequire-end-block, r=nikomatsakis
MIR: Do not require END_BLOCK to always exist Basically, all this does, is removing restriction for END_BLOCK to exist past the first invocation of RemoveDeadBlocks pass. This way for functions whose CFG does not reach the `END_BLOCK` end up not containing the block. As far as the implementation goes, I’m not entirely satisfied with the `BasicBlock::end_block`. I had hoped to make `new` a `const fn` and then just have a `const END_BLOCK` private to mir::build, but it turns out that constant functions don’t yet support conditionals nor a way to assert.
This commit is contained in:
commit
6e03608209
5 changed files with 35 additions and 29 deletions
|
|
@ -63,9 +63,6 @@ pub struct Mir<'tcx> {
|
|||
/// where execution begins
|
||||
pub const START_BLOCK: BasicBlock = BasicBlock(0);
|
||||
|
||||
/// where execution ends, on normal return
|
||||
pub const END_BLOCK: BasicBlock = BasicBlock(1);
|
||||
|
||||
impl<'tcx> Mir<'tcx> {
|
||||
pub fn all_basic_blocks(&self) -> Vec<BasicBlock> {
|
||||
(0..self.basic_blocks.len())
|
||||
|
|
@ -322,8 +319,7 @@ pub enum TerminatorKind<'tcx> {
|
|||
Resume,
|
||||
|
||||
/// Indicates a normal return. The ReturnPointer lvalue should
|
||||
/// have been filled in by now. This should only occur in the
|
||||
/// `END_BLOCK`.
|
||||
/// have been filled in by now. This should occur at most once.
|
||||
Return,
|
||||
|
||||
/// Drop the Lvalue
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue