From 21cd1fe0bddf68062d6edd858781eaffd0dfcaaa Mon Sep 17 00:00:00 2001 From: Dylan MacKenzie Date: Fri, 28 Feb 2020 20:57:36 -0800 Subject: [PATCH] Process `RequiresStorage` results in pre-order Reverse post-order requires an allocation. --- src/librustc_mir/transform/generator.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/librustc_mir/transform/generator.rs b/src/librustc_mir/transform/generator.rs index 770f93517d058..3107be1b62207 100644 --- a/src/librustc_mir/transform/generator.rs +++ b/src/librustc_mir/transform/generator.rs @@ -619,8 +619,9 @@ fn compute_storage_conflicts( local_conflicts: BitMatrix::from_row_n(&ineligible_locals, body.local_decls.len()), }; - // FIXME: Do we need to do this in RPO? - requires_storage.visit_in_rpo_with(body, &mut visitor); + // Visit only reachable basic blocks. The exact order is not important. + let reachable_blocks = traversal::preorder(body).map(|(bb, _)| bb); + requires_storage.visit_with(body, reachable_blocks, &mut visitor); let local_conflicts = visitor.local_conflicts;