Skip to content

Commit cab8e35

Browse files
committed
Use the postorder cache in traversal::postorder.
1 parent e04e19d commit cab8e35

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

compiler/rustc_middle/src/mir/traversal.rs

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

191-
pub fn postorder<'a, 'tcx>(body: &'a Body<'tcx>) -> Postorder<'a, 'tcx> {
192-
Postorder::new(&body.basic_blocks, START_BLOCK)
191+
pub type PostorderIter<'a, 'tcx: 'a> =
192+
impl Iterator<Item = (BasicBlock, &'a BasicBlockData<'tcx>)> + ExactSizeIterator;
193+
194+
pub fn postorder<'a, 'tcx>(body: &'a Body<'tcx>) -> PostorderIter<'a, 'tcx> {
195+
body.basic_blocks.postorder().iter().map(|&bb| (bb, &body.basic_blocks[bb]))
193196
}
194197

195198
impl<'a, 'tcx> Iterator for Postorder<'a, 'tcx> {

0 commit comments

Comments
 (0)