@@ -483,20 +483,23 @@ impl<'tcx> MutVisitor<'tcx> for VnState<'_, 'tcx> {
483
483
}
484
484
485
485
fn visit_statement ( & mut self , stmt : & mut Statement < ' tcx > , location : Location ) {
486
- self . super_statement ( stmt, location) ;
487
486
if let StatementKind :: Assign ( box ( _, ref mut rvalue) ) = stmt. kind
488
487
// Do not try to simplify a constant, it's already in canonical shape.
489
488
&& !matches ! ( rvalue, Rvalue :: Use ( Operand :: Constant ( _) ) )
490
- && let Some ( value) = self . simplify_rvalue ( rvalue, location)
491
489
{
492
- if let Some ( const_) = self . try_as_constant ( value) {
493
- * rvalue = Rvalue :: Use ( Operand :: Constant ( Box :: new ( const_) ) ) ;
494
- } else if let Some ( local) = self . try_as_local ( value, location)
495
- && * rvalue != Rvalue :: Use ( Operand :: Move ( local. into ( ) ) )
490
+ if let Some ( value) = self . simplify_rvalue ( rvalue, location)
496
491
{
497
- * rvalue = Rvalue :: Use ( Operand :: Copy ( local. into ( ) ) ) ;
498
- self . reused_locals . insert ( local) ;
492
+ if let Some ( const_) = self . try_as_constant ( value) {
493
+ * rvalue = Rvalue :: Use ( Operand :: Constant ( Box :: new ( const_) ) ) ;
494
+ } else if let Some ( local) = self . try_as_local ( value, location)
495
+ && * rvalue != Rvalue :: Use ( Operand :: Move ( local. into ( ) ) )
496
+ {
497
+ * rvalue = Rvalue :: Use ( Operand :: Copy ( local. into ( ) ) ) ;
498
+ self . reused_locals . insert ( local) ;
499
+ }
499
500
}
501
+ } else {
502
+ self . super_statement ( stmt, location) ;
500
503
}
501
504
}
502
505
}
0 commit comments