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