@@ -1366,16 +1366,17 @@ impl<'body, 'tcx> VnState<'body, 'tcx> {
13661366
13671367    fn  simplify_cast ( 
13681368        & mut  self , 
1369-         kind :  & mut  CastKind , 
1370-         operand :  & mut  Operand < ' tcx > , 
1369+         initial_kind :  & mut  CastKind , 
1370+         initial_operand :  & mut  Operand < ' tcx > , 
13711371        to :  Ty < ' tcx > , 
13721372        location :  Location , 
13731373    )  -> Option < VnIndex >  { 
13741374        use  CastKind :: * ; 
13751375        use  rustc_middle:: ty:: adjustment:: PointerCoercion :: * ; 
13761376
1377-         let  mut  from = operand. ty ( self . local_decls ,  self . tcx ) ; 
1378-         let  mut  value = self . simplify_operand ( operand,  location) ?; 
1377+         let  mut  from = initial_operand. ty ( self . local_decls ,  self . tcx ) ; 
1378+         let  mut  kind = * initial_kind; 
1379+         let  mut  value = self . simplify_operand ( initial_operand,  location) ?; 
13791380        if  from == to { 
13801381            return  Some ( value) ; 
13811382        } 
@@ -1399,7 +1400,7 @@ impl<'body, 'tcx> VnState<'body, 'tcx> {
13991400                && to. is_unsafe_ptr ( ) 
14001401                && self . pointers_have_same_metadata ( from,  to) 
14011402            { 
1402-                 * kind = PtrToPtr ; 
1403+                 kind = PtrToPtr ; 
14031404                was_updated_this_iteration = true ; 
14041405            } 
14051406
@@ -1442,7 +1443,7 @@ impl<'body, 'tcx> VnState<'body, 'tcx> {
14421443                to :  inner_to, 
14431444            }  = * self . get ( value) 
14441445            { 
1445-                 let  new_kind = match  ( inner_kind,  * kind)  { 
1446+                 let  new_kind = match  ( inner_kind,  kind)  { 
14461447                    // Even if there's a narrowing cast in here that's fine, because 
14471448                    // things like `*mut [i32] -> *mut i32 -> *const i32` and 
14481449                    // `*mut [i32] -> *const [i32] -> *const i32` can skip the middle in MIR. 
@@ -1470,7 +1471,7 @@ impl<'body, 'tcx> VnState<'body, 'tcx> {
14701471                    _ => None , 
14711472                } ; 
14721473                if  let  Some ( new_kind)  = new_kind { 
1473-                     * kind = new_kind; 
1474+                     kind = new_kind; 
14741475                    from = inner_from; 
14751476                    value = inner_value; 
14761477                    was_updated_this_iteration = true ; 
@@ -1488,10 +1489,11 @@ impl<'body, 'tcx> VnState<'body, 'tcx> {
14881489        } 
14891490
14901491        if  was_ever_updated && let  Some ( op)  = self . try_as_operand ( value,  location)  { 
1491-             * operand = op; 
1492+             * initial_operand = op; 
1493+             * initial_kind = kind; 
14921494        } 
14931495
1494-         Some ( self . insert ( Value :: Cast  {  kind :   * kind ,  value,  from,  to } ) ) 
1496+         Some ( self . insert ( Value :: Cast  {  kind,  value,  from,  to } ) ) 
14951497    } 
14961498
14971499    fn  simplify_len ( & mut  self ,  place :  & mut  Place < ' tcx > ,  location :  Location )  -> Option < VnIndex >  { 
0 commit comments