| Ralf Jung | 75d0fdd | 2024-04-20 13:19:34 +0200 | [diff] [blame] | 1 | //@ test-mir-pass: GVN |
| Oliver Scherer | a1ebb94 | 2020-05-06 19:28:48 +0200 | [diff] [blame] | 2 | |
| Camille GILLOT | d91bb50 | 2023-12-02 20:50:00 +0000 | [diff] [blame] | 3 | // Verify that we do not propagate the contents of this mutable static. |
| Ulrich Weigand | 6885733 | 2022-12-22 16:33:12 +0100 | [diff] [blame] | 4 | static mut STATIC: u32 = 0x42424242; |
| Oliver Scherer | a1ebb94 | 2020-05-06 19:28:48 +0200 | [diff] [blame] | 5 | |
| Camille GILLOT | 2837727 | 2023-09-20 21:43:33 +0000 | [diff] [blame] | 6 | // EMIT_MIR mutable_variable_no_prop.main.GVN.diff |
| Oliver Scherer | a1ebb94 | 2020-05-06 19:28:48 +0200 | [diff] [blame] | 7 | fn main() { |
| Camille GILLOT | d91bb50 | 2023-12-02 20:50:00 +0000 | [diff] [blame] | 8 | // CHECK-LABEL: fn main( |
| 9 | // CHECK: debug x => [[x:_.*]]; |
| 10 | // CHECK: debug y => [[y:_.*]]; |
| 11 | // CHECK: [[x]] = const 42_u32; |
| Scott McMurray | 249a36f | 2024-08-18 15:51:53 -0700 | [diff] [blame] | 12 | // CHECK: [[tmp:_.*]] = copy (*{{_.*}}); |
| Camille GILLOT | d91bb50 | 2023-12-02 20:50:00 +0000 | [diff] [blame] | 13 | // CHECK: [[x]] = move [[tmp]]; |
| Scott McMurray | 249a36f | 2024-08-18 15:51:53 -0700 | [diff] [blame] | 14 | // CHECK: [[y]] = copy [[x]]; |
| Oliver Scherer | a1ebb94 | 2020-05-06 19:28:48 +0200 | [diff] [blame] | 15 | let mut x = 42; |
| 16 | unsafe { |
| 17 | x = STATIC; |
| 18 | } |
| 19 | let y = x; |
| 20 | } |