Skip to content

Commit 3816c15

Browse files
committed
Only visit reachable nodes in SsaLocals.
1 parent 255ca18 commit 3816c15

File tree

1 file changed

+4
-8
lines changed
  • compiler/rustc_mir_transform/src

1 file changed

+4
-8
lines changed

compiler/rustc_mir_transform/src/ssa.rs

+4-8
Original file line numberDiff line numberDiff line change
@@ -78,14 +78,10 @@ impl SsaLocals {
7878
visitor.assignments[local] = Set1::One(LocationExtended::Arg);
7979
}
8080

81-
if body.basic_blocks.len() > 2 {
82-
for (bb, data) in traversal::reverse_postorder(body) {
83-
visitor.visit_basic_block_data(bb, data);
84-
}
85-
} else {
86-
for (bb, data) in body.basic_blocks.iter_enumerated() {
87-
visitor.visit_basic_block_data(bb, data);
88-
}
81+
// For SSA assignments, a RPO visit will see the assignment before it sees any use.
82+
// We only visit reachable nodes: computing `dominates` on an unreachable node ICEs.
83+
for (bb, data) in traversal::reverse_postorder(body) {
84+
visitor.visit_basic_block_data(bb, data);
8985
}
9086

9187
for var_debug_info in &body.var_debug_info {

0 commit comments

Comments
 (0)