mirror of
https://github.com/rust-lang/rust.git
synced 2025-09-27 12:48:20 +00:00

We cannot transform `*elem` to `array[idx1]` in the following code, as `idx1` has already been modified. ```rust mir! { let array; let elem; { array = [*val; 5]; elem = &array[idx1]; idx1 = idx2; RET = *elem; Return() } } ```
19 lines
390 B
Diff
19 lines
390 B
Diff
- // MIR for `repeat_local` before GVN
|
|
+ // MIR for `repeat_local` after GVN
|
|
|
|
fn repeat_local(_1: usize, _2: usize, _3: i32) -> i32 {
|
|
let mut _0: i32;
|
|
let mut _4: [i32; 5];
|
|
let mut _5: &i32;
|
|
|
|
bb0: {
|
|
_4 = [copy _3; 5];
|
|
_5 = &_4[_1];
|
|
_1 = copy _2;
|
|
- _0 = copy (*_5);
|
|
+ _0 = copy _3;
|
|
return;
|
|
}
|
|
}
|
|
|