Repository navigation
[experiment] No Terminator Option - #165369
panstromek wants to merge 3 commits into
Conversation
|
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
[experiment] No Terminator Option
|
The job Click to see the possible cause of the failure (guessed by this bot) |
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (aa85a99): comparison URL. Overall result: ✅ improvements - no action neededBenchmarking means the PR may be perf-sensitive. Consider adding rollup=never if this change is not fit for rolling up. @rustbot label: -S-waiting-on-perf -perf-regression Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)Results (secondary 2.2%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (primary -2.3%, secondary 3.6%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeThis perf run didn't have relevant results for this metric. Bootstrap: 483.826s -> 484.513s (0.14%) |
|
simplifies the code, so ship it I guess? was this ever actually a |
Yes, it is None during MIR building and in some mir opts - most notably in SimplifyCfg. I think there's 1-2 other ones as well. I want get rid of the This might be a good awkwardness tradeoff, but it will make it more difficult to reason about and bugs surface later (when indexing into basic blocks). I'd rather refactor these places a bit to avoid the need for an option. |
|
Ahhh. Yeaaaahhh. |
|
☔ The latest upstream changes (presumably #165597) made this pull request unmergeable. Please resolve the merge conflicts by rebasing. |
| fn take_terminator_if_simple_goto(&mut self, bb: BasicBlock) -> Option<Terminator<'tcx>> { | ||
| match self.basic_blocks[bb] { | ||
| BasicBlockData { | ||
| ref statements, | ||
| terminator: | ||
| ref mut terminator @ Some(Terminator { kind: TerminatorKind::Goto { .. }, .. }), | ||
| ref mut terminator @ Terminator { kind: TerminatorKind::Goto { .. }, .. }, | ||
| .. | ||
| } if statements.is_empty() => terminator.take(), | ||
| // if `terminator` is None, this means we are in a loop. In that | ||
| // case, let all the loop collapse to its entry. | ||
| _ => None, | ||
| } | ||
| } |
There was a problem hiding this comment.
This function used to match only on Some but after using Goto MaxBB terminator as a sentinel, it will also match on that sentinel (what would be None in the old version). It's fascinating that this still works and passes all the tests. I wonder whether we accidentaly do more rounds of simpliciations because of this or similar matches in this optimization pass.
But maybe this problem is contained here because we use terminator.take which will return None even if this match matches, because it will detect the Goto Sentinel.
I can't believe this passed the tests first try.