IncrementalCompact: fix display of basic block boundaries. #47043
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #46424 again, as the first attempt in #46644 was insufficient.
The problem with CFGs during incremental compaction is that the basic block boundaries are not properly determined until after compaction. We rely on
finish_current_bb!
to finalize a bb, but that only triggers when we've seen all the statements in a block. That's a problem when displaying part of a compacted block, resulting in an incorrectbb_idx
and display breaking down:Similarly,
finish_current_bb!
also updates the start statement index of the next basic block. That's a problem when the boundary of the compacted and uncompacted nodes is at the boundary of two basic blocks, because we then callshow_ir_stmts
with a CFG where the current active block has a broken statement range (the start is an index intoresult_bbs
, while the end is still an index into the original instruction stream).I don't particularly like the patching-up of CFGs in
show_ir
, but the alternative (changing howfinalize_current_bb!
works and is invoked) seemed like a way more riskier change.