This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +27
-3
lines changed
tests/mir-opt/dataflow-const-prop Expand file tree Collapse file tree 3 files changed +27
-3
lines changed Original file line number Diff line number Diff line change 1
- // skip-filecheck
2
1
// unit-test: DataflowConstProp
3
2
4
3
// EMIT_MIR self_assign.main.DataflowConstProp.diff
4
+
5
+ // CHECK-LABEL: fn main
5
6
fn main ( ) {
7
+ // CHECK: debug a => [[a:_.*]];
8
+ // CHECK: debug b => [[b:_.*]];
9
+
6
10
let mut a = 0 ;
11
+
12
+ // CHECK: [[a]] = Add(move {{_[0-9]+}}, const 1_i32);
7
13
a = a + 1 ;
14
+
15
+ // CHECK: [[a]] = move {{_[0-9]+}};
8
16
a = a;
9
17
18
+ // CHECK: [[b]] = &[[a]];
10
19
let mut b = & a;
20
+
21
+ // CHECK: [[b]] = move {{_[0-9]+}};
11
22
b = b;
23
+
24
+ // CHECK: [[a]] = move {{_[0-9]+}};
12
25
a = * b;
13
26
}
Original file line number Diff line number Diff line change 1
- // skip-filecheck
2
1
// unit-test: DataflowConstProp
3
2
4
3
// EMIT_MIR self_assign_add.main.DataflowConstProp.diff
4
+
5
+ // CHECK-LABEL: fn main
5
6
fn main ( ) {
7
+ // CHECK: debug a => [[a:_.*]];
6
8
let mut a = 0 ;
9
+
10
+ // CHECK: [[a]] = const 1_i32;
7
11
a += 1 ;
12
+
13
+ // CHECK: [[a]] = const 2_i32;
8
14
a += 1 ;
9
15
}
Original file line number Diff line number Diff line change 1
- // skip-filecheck
2
1
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
3
2
// This attempts to modify `x.1` via a pointer derived from `addr_of_mut!(x.0)`.
4
3
// According to Miri, that is UB. However, T-opsem has not finalized that
10
9
// unit-test: DataflowConstProp
11
10
12
11
// EMIT_MIR sibling_ptr.main.DataflowConstProp.diff
12
+
13
+ // CHECK-LABEL: fn main
13
14
fn main ( ) {
15
+ // CHECK: debug x1 => [[x1:_[0-9]+]];
16
+
14
17
let mut x: ( u8 , u8 ) = ( 0 , 0 ) ;
15
18
unsafe {
16
19
let p = std:: ptr:: addr_of_mut!( x. 0 ) ;
17
20
* p. add ( 1 ) = 1 ;
18
21
}
22
+
23
+ // CHECK: [[x1]] = ({{_[0-9]+}}.1: u8);
19
24
let x1 = x. 1 ; // should not be propagated
20
25
}
You can’t perform that action at this time.
0 commit comments