Repository navigation
Avoid terminator: None in custom mir parser - #165502
panstromek wants to merge 2 commits into
Conversation
|
r? @nnethercote rustbot has assigned @nnethercote. Use Why was this reviewer chosen?The reviewer was selected based on:
|
This comment has been minimized.
This comment has been minimized.
…minator This was only needed because `is_cleanup` property was parsed separately from the basic block data, so we do this by parsing `is_cleanup` into a vec of bools first, and later transform it into the bb data when parsing blocks themselves.
16f2ca6 to
ca5705a
Compare
| // just a sanity check to make sure order of bbs | ||
| // in cleanup blocks matches the one in the body | ||
| assert_eq!(inserted_bb, bb); |
There was a problem hiding this comment.
I'm not sure I understand what this checks / what "order of BBs in cleanup blocks" means. We're comparing bb = i, which we get from enumerate of block_defs, with the index in the body's basic block list. That should always be true, unless something sneakily pushes another basic block before this loop or inside parse_block_def. Maybe that's what you had in mind, but either way the comment needs to be clearer.
| thir: &'a Thir<'tcx>, | ||
| source_scope: SourceScope, | ||
| body: &'a mut Body<'tcx>, | ||
| cleanup_blocks: IndexVec<BasicBlock, bool>, |
There was a problem hiding this comment.
Should this be a GrowableBitSet? The memory footprint doesn't matter, but it seems conceptually more appropriate than IndexVec<_, bool>.
|
Reminder, once the PR becomes ready for a review, use |
|
☔ The latest upstream changes (presumably #165597) made this pull request unmergeable. Please resolve the merge conflicts by rebasing. |
First step towards replacing
Option<Terminator>withTerminatorinBasicBlockData. See this thread for more info.This is a slight restructuring of the custom mir parser that avoids creating dummy basic blocks that don't have terminators. More details in individual commits.