Reverse postorder instead of using reversed postorder

This commit is contained in:
Maybe Waffle 2023-09-28 23:50:56 +00:00
parent 0e0dc59acb
commit 27242437c7

View File

@ -30,7 +30,13 @@ pub fn visit_local_usage(locals: &[Local], mir: &Body<'_>, location: Location) -
locals.len() locals.len()
]; ];
traversal::ReversePostorder::new(mir, location.block).try_fold(init, |usage, (tbb, tdata)| { traversal::Postorder::new(&mir.basic_blocks, location.block)
.collect::<Vec<_>>()
.into_iter()
.rev()
.try_fold(init, |usage, tbb| {
let tdata = &mir.basic_blocks[tbb];
// Give up on loops // Give up on loops
if tdata.terminator().successors().any(|s| s == location.block) { if tdata.terminator().successors().any(|s| s == location.block) {
return None; return None;