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