@@ -34,8 +34,8 @@ impl<'tcx> crate::MirPass<'tcx> for RemoveNoopLandingPads {
34
34
35
35
// This is a post-order traversal, so that if A post-dominates B
36
36
// then A will be visited before B.
37
- for & bb in body . basic_blocks . reverse_postorder ( ) . iter ( ) . rev ( ) {
38
- let is_nop_landing_pad = self . is_nop_landing_pad ( bb , body , & nop_landing_pads) ;
37
+ for ( bb , bbdata ) in traversal :: postorder ( body ) {
38
+ let is_nop_landing_pad = self . is_nop_landing_pad ( bbdata , & nop_landing_pads) ;
39
39
debug ! ( "is_nop_landing_pad({bb:?}) = {is_nop_landing_pad}" ) ;
40
40
if is_nop_landing_pad {
41
41
nop_landing_pads. insert ( bb) ;
@@ -85,11 +85,10 @@ impl<'tcx> crate::MirPass<'tcx> for RemoveNoopLandingPads {
85
85
impl RemoveNoopLandingPads {
86
86
fn is_nop_landing_pad (
87
87
& self ,
88
- bb : BasicBlock ,
89
- body : & Body < ' _ > ,
88
+ bbdata : & BasicBlockData < ' _ > ,
90
89
nop_landing_pads : & DenseBitSet < BasicBlock > ,
91
90
) -> bool {
92
- for stmt in & body [ bb ] . statements {
91
+ for stmt in & bbdata . statements {
93
92
match & stmt. kind {
94
93
StatementKind :: FakeRead ( ..)
95
94
| StatementKind :: StorageLive ( _)
@@ -122,7 +121,7 @@ impl RemoveNoopLandingPads {
122
121
}
123
122
}
124
123
125
- let terminator = body [ bb ] . terminator ( ) ;
124
+ let terminator = bbdata . terminator ( ) ;
126
125
match terminator. kind {
127
126
TerminatorKind :: Goto { .. }
128
127
| TerminatorKind :: UnwindResume
0 commit comments