Auto merge of #116254 - WaffleLapkin:nicen-traversal, r=cjgillot
Assorted improvements for `rustc_middle::mir::traversal` r? `@cjgillot` I'm not _entirely_ sure about all changes, although I do like all of them. If you'd like I can drop some commits. Best reviewed on a commit-by-commit basis, I think, since they are fairly isolated.
This commit is contained in:
commit
ad0b7ed61f
@ -30,7 +30,13 @@ pub fn visit_local_usage(locals: &[Local], mir: &Body<'_>, location: Location) -
|
||||
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
|
||||
if tdata.terminator().successors().any(|s| s == location.block) {
|
||||
return None;
|
||||
|
Loading…
Reference in New Issue
Block a user