@@ -47,7 +47,9 @@ fn eq_not_post_visitor_mutations<'tcx>(
47
47
for ( location, eq_not_opt_info) in eq_not_opts. iter ( ) {
48
48
let statements = & mut body. basic_blocks_mut ( ) [ location. block ] . statements ;
49
49
// We have to make sure that Ne is before any StorageDead as the operand being killed is used in the Ne
50
- if let Some ( storage_dead_idx_to_swap_with) = eq_not_opt_info. storage_dead_to_swap_with_ne {
50
+ if let Some ( storage_dead_idx_to_swap_with) =
51
+ eq_not_opt_info. storage_dead_idx_to_swap_with_ne
52
+ {
51
53
statements. swap ( location. statement_index , storage_dead_idx_to_swap_with) ;
52
54
}
53
55
if let Some ( eq_stmt_idx) = eq_not_opt_info. can_remove_eq {
@@ -320,7 +322,7 @@ impl OptimizationFinder<'b, 'tcx> {
320
322
EqNotOptInfo {
321
323
op1 : op1. clone ( ) ,
322
324
op2 : op2. clone ( ) ,
323
- storage_dead_to_swap_with_ne : storage_dead_to_swap,
325
+ storage_dead_idx_to_swap_with_ne : storage_dead_to_swap,
324
326
can_remove_eq,
325
327
} ,
326
328
) ;
@@ -395,9 +397,14 @@ impl Visitor<'tcx> for OptimizationFinder<'b, 'tcx> {
395
397
396
398
#[ derive( Clone ) ]
397
399
struct EqNotOptInfo < ' tcx > {
400
+ /// First operand of the Eq in the Eq-Not pair
398
401
op1 : Operand < ' tcx > ,
402
+ /// Second operand of the Eq in the Eq-Not pair
399
403
op2 : Operand < ' tcx > ,
400
- storage_dead_to_swap_with_ne : Option < usize > ,
404
+ /// Statement index of the `StorageDead` we want to swap with Ne.
405
+ /// None if no `StorageDead` exists between Eq and Not pair)
406
+ storage_dead_idx_to_swap_with_ne : Option < usize > ,
407
+ // Statement index of the Eq. None if it can not be removed
401
408
can_remove_eq : Option < usize > ,
402
409
}
403
410
0 commit comments