Skip to content

Commit a7f3c4e

Browse files
committed
Don't resolve basic block data in Postorder
The only usage immediately throws out the data, so.
1 parent 0d8a458 commit a7f3c4e

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

compiler/rustc_middle/src/mir/basic_blocks.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,7 @@ impl<'tcx> BasicBlocks<'tcx> {
6666
#[inline]
6767
pub fn reverse_postorder(&self) -> &[BasicBlock] {
6868
self.cache.reverse_postorder.get_or_init(|| {
69-
let mut rpo: Vec<_> =
70-
Postorder::new(&self.basic_blocks, START_BLOCK).map(|(bb, _)| bb).collect();
69+
let mut rpo: Vec<_> = Postorder::new(&self.basic_blocks, START_BLOCK).collect();
7170
rpo.reverse();
7271
rpo
7372
})

compiler/rustc_middle/src/mir/traversal.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -188,14 +188,14 @@ impl<'a, 'tcx> Postorder<'a, 'tcx> {
188188
}
189189
}
190190

191-
impl<'a, 'tcx> Iterator for Postorder<'a, 'tcx> {
192-
type Item = (BasicBlock, &'a BasicBlockData<'tcx>);
191+
impl<'tcx> Iterator for Postorder<'_, 'tcx> {
192+
type Item = BasicBlock;
193193

194-
fn next(&mut self) -> Option<(BasicBlock, &'a BasicBlockData<'tcx>)> {
194+
fn next(&mut self) -> Option<BasicBlock> {
195195
let (bb, _) = self.visit_stack.pop()?;
196196
self.traverse_successor();
197-
198-
Some((bb, &self.basic_blocks[bb]))
197+
198+
Some(bb)
199199
}
200200

201201
fn size_hint(&self) -> (usize, Option<usize>) {

0 commit comments

Comments
 (0)