@@ -47,7 +47,9 @@ fn eq_not_post_visitor_mutations<'tcx>(
4747 for ( location, eq_not_opt_info) in eq_not_opts. iter ( ) {
4848 let statements = & mut body. basic_blocks_mut ( ) [ location. block ] . statements ;
4949 // 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+ {
5153 statements. swap ( location. statement_index , storage_dead_idx_to_swap_with) ;
5254 }
5355 if let Some ( eq_stmt_idx) = eq_not_opt_info. can_remove_eq {
@@ -320,7 +322,7 @@ impl OptimizationFinder<'b, 'tcx> {
320322 EqNotOptInfo {
321323 op1 : op1. clone ( ) ,
322324 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,
324326 can_remove_eq,
325327 } ,
326328 ) ;
@@ -395,9 +397,14 @@ impl Visitor<'tcx> for OptimizationFinder<'b, 'tcx> {
395397
396398#[ derive( Clone ) ]
397399struct EqNotOptInfo < ' tcx > {
400+ /// First operand of the Eq in the Eq-Not pair
398401 op1 : Operand < ' tcx > ,
402+ /// Second operand of the Eq in the Eq-Not pair
399403 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
401408 can_remove_eq : Option < usize > ,
402409}
403410
0 commit comments