diff options
| author | Dylan MacKenzie <ecstaticmorse@gmail.com> | 2020-04-19 13:56:49 -0700 |
|---|---|---|
| committer | Dylan MacKenzie <ecstaticmorse@gmail.com> | 2020-04-22 09:57:43 -0700 |
| commit | 4e7469eaeaaa460828f0494de97b6ce4203a44a5 (patch) | |
| tree | 5bf96a7b8fc6a4d234b0f2ea63d4b000991a1f3e | |
| parent | 2ff1fc9b81c0764eaa43faaa8985c3669759c814 (diff) | |
| download | rust-4e7469eaeaaa460828f0494de97b6ce4203a44a5.tar.gz rust-4e7469eaeaaa460828f0494de97b6ce4203a44a5.zip | |
Replace multiple calls to `predecessors_for`
...with a single one to `predecessors`. `predecessors_for` requires taking the lock/incrementing the `RefCell` once each call.
| -rw-r--r-- | src/librustc_middle/mir/mod.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/librustc_middle/mir/mod.rs b/src/librustc_middle/mir/mod.rs index ea3e59666d6..e476729c11b 100644 --- a/src/librustc_middle/mir/mod.rs +++ b/src/librustc_middle/mir/mod.rs @@ -2716,14 +2716,16 @@ impl Location { return true; } + let predecessors = body.predecessors(); + // If we're in another block, then we want to check that block is a predecessor of `other`. - let mut queue: Vec<BasicBlock> = body.predecessors_for(other.block).to_vec(); + let mut queue: Vec<BasicBlock> = predecessors[other.block].to_vec(); let mut visited = FxHashSet::default(); while let Some(block) = queue.pop() { // If we haven't visited this block before, then make sure we visit it's predecessors. if visited.insert(block) { - queue.extend(body.predecessors_for(block).iter().cloned()); + queue.extend(predecessors[block].iter().cloned()); } else { continue; } |
