-
Notifications
You must be signed in to change notification settings - Fork 13.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Calculate predecessor count directly #138076
Conversation
Edges to the start block are invalid. The special case is unnecessary.
Avoid allocating a vector of small vectors merely to determine how many predecessors each basic block has. Additionally use u8 and saturating operations. The pass only needs to distinguish between [0..1] and [2..].
rustbot has assigned @matthewjasper. Use |
Some changes occurred to MIR optimizations cc @rust-lang/wg-mir-opt |
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
Calculate predecessor count directly Avoid allocating a vector of small vectors merely to determine how many predecessors each basic block has. Additionally use u8 and saturating operations. The pass only needs to distinguish between [0..1] and [2..].
@@ -32,9 +32,12 @@ pub(super) use self::AddCallGuards::*; | |||
|
|||
impl<'tcx> crate::MirPass<'tcx> for AddCallGuards { | |||
fn run_pass(&self, _tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) { | |||
let mut pred_count: IndexVec<_, _> = | |||
body.basic_blocks.predecessors().iter().map(|ps| ps.len()).collect(); | |||
pred_count[START_BLOCK] += 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Start block has no predecessors since #88968, so this special case is no longer necessary.
💥 Test timed out |
@bors try |
Calculate predecessor count directly Avoid allocating a vector of small vectors merely to determine how many predecessors each basic block has. Additionally use u8 and saturating operations. The pass only needs to distinguish between [0..1] and [2..].
💔 Test failed - checks-actions |
@bors try |
Calculate predecessor count directly Avoid allocating a vector of small vectors merely to determine how many predecessors each basic block has. Additionally use u8 and saturating operations. The pass only needs to distinguish between [0..1] and [2..].
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
Finished benchmarking commit (5b8ba42): comparison URL. Overall result: no relevant changes - no action neededBenchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf. @bors rollup=never Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)Results (primary -2.1%, secondary -1.5%)This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesResults (secondary 0.6%)This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 773.363s -> 773.423s (0.01%) |
@bors r+ |
☀️ Test successful - checks-actions |
Post-merge analysis result Test differencesNo test diffs found |
Finished benchmarking commit (0e76f8b): comparison URL. Overall result: ❌ regressions - no action needed@rustbot label: -perf-regression Instruction countThis is the most reliable metric that we have; it was used to determine the overall result at the top of this comment. However, even this metric can sometimes exhibit noise.
Max RSS (memory usage)Results (primary 2.3%, secondary 6.0%)This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesResults (secondary -2.1%)This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 777.224s -> 777.49s (0.03%) |
Avoid allocating a vector of small vectors merely to determine how many
predecessors each basic block has.
Additionally use u8 and saturating operations. The pass only needs to
distinguish between [0..1] and [2..].