@@ -1367,16 +1367,17 @@ impl<'body, 'tcx> VnState<'body, 'tcx> {
1367
1367
1368
1368
fn simplify_cast (
1369
1369
& mut self ,
1370
- kind : & mut CastKind ,
1371
- operand : & mut Operand < ' tcx > ,
1370
+ initial_kind : & mut CastKind ,
1371
+ initial_operand : & mut Operand < ' tcx > ,
1372
1372
to : Ty < ' tcx > ,
1373
1373
location : Location ,
1374
1374
) -> Option < VnIndex > {
1375
1375
use CastKind :: * ;
1376
1376
use rustc_middle:: ty:: adjustment:: PointerCoercion :: * ;
1377
1377
1378
- let mut from = operand. ty ( self . local_decls , self . tcx ) ;
1379
- let mut value = self . simplify_operand ( operand, location) ?;
1378
+ let mut from = initial_operand. ty ( self . local_decls , self . tcx ) ;
1379
+ let mut kind = * initial_kind;
1380
+ let mut value = self . simplify_operand ( initial_operand, location) ?;
1380
1381
if from == to {
1381
1382
return Some ( value) ;
1382
1383
}
@@ -1400,7 +1401,7 @@ impl<'body, 'tcx> VnState<'body, 'tcx> {
1400
1401
&& to. is_unsafe_ptr ( )
1401
1402
&& self . pointers_have_same_metadata ( from, to)
1402
1403
{
1403
- * kind = PtrToPtr ;
1404
+ kind = PtrToPtr ;
1404
1405
was_updated_this_iteration = true ;
1405
1406
}
1406
1407
@@ -1443,7 +1444,7 @@ impl<'body, 'tcx> VnState<'body, 'tcx> {
1443
1444
to : inner_to,
1444
1445
} = * self . get ( value)
1445
1446
{
1446
- let new_kind = match ( inner_kind, * kind) {
1447
+ let new_kind = match ( inner_kind, kind) {
1447
1448
// Even if there's a narrowing cast in here that's fine, because
1448
1449
// things like `*mut [i32] -> *mut i32 -> *const i32` and
1449
1450
// `*mut [i32] -> *const [i32] -> *const i32` can skip the middle in MIR.
@@ -1471,7 +1472,7 @@ impl<'body, 'tcx> VnState<'body, 'tcx> {
1471
1472
_ => None ,
1472
1473
} ;
1473
1474
if let Some ( new_kind) = new_kind {
1474
- * kind = new_kind;
1475
+ kind = new_kind;
1475
1476
from = inner_from;
1476
1477
value = inner_value;
1477
1478
was_updated_this_iteration = true ;
@@ -1489,10 +1490,11 @@ impl<'body, 'tcx> VnState<'body, 'tcx> {
1489
1490
}
1490
1491
1491
1492
if was_ever_updated && let Some ( op) = self . try_as_operand ( value, location) {
1492
- * operand = op;
1493
+ * initial_operand = op;
1494
+ * initial_kind = kind;
1493
1495
}
1494
1496
1495
- Some ( self . insert ( Value :: Cast { kind : * kind , value, from, to } ) )
1497
+ Some ( self . insert ( Value :: Cast { kind, value, from, to } ) )
1496
1498
}
1497
1499
1498
1500
fn simplify_len ( & mut self , place : & mut Place < ' tcx > , location : Location ) -> Option < VnIndex > {
0 commit comments