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