File tree Expand file tree Collapse file tree 2 files changed +28
-2
lines changed
tests/mir-opt/dataflow-const-prop Expand file tree Collapse file tree 2 files changed +28
-2
lines changed Original file line number Diff line number Diff line change 1
- // skip-filecheck
2
1
// unit-test: DataflowConstProp
3
2
// compile-flags: -Coverflow-checks=on
4
3
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
5
4
6
5
// EMIT_MIR checked.main.DataflowConstProp.diff
7
6
#[ allow( arithmetic_overflow) ]
7
+
8
+ // CHECK-LABEL: fn main(
8
9
fn main ( ) {
10
+ // CHECK: debug a => [[a:_.*]];
11
+ // CHECK: debug b => [[b:_.*]];
12
+ // CHECK: debug c => [[c:_.*]];
13
+ // CHECK: debug d => [[d:_.*]];
14
+ // CHECK: debug e => [[e:_.*]];
15
+
16
+ // CHECK: [[a]] = const 1_i32;
9
17
let a = 1 ;
18
+
19
+ // CHECK: [[b]] = const 2_i32;
10
20
let b = 2 ;
21
+
22
+ // CHECK: [[c]] = const 3_i32;
11
23
let c = a + b;
12
24
25
+ // CHECK: [[d]] = const _;
13
26
let d = i32:: MAX ;
27
+
28
+ // CHECK: [[e]] = const i32::MIN;
14
29
let e = d + 1 ;
15
30
}
Original file line number Diff line number Diff line change 1
- // skip-filecheck
2
1
// unit-test: DataflowConstProp
3
2
// compile-flags: -Zmir-enable-passes=+GVN,+Inline
4
3
// ignore-debug assertions change the output MIR
@@ -11,8 +10,20 @@ struct A {
11
10
12
11
// EMIT_MIR default_boxed_slice.main.GVN.diff
13
12
// EMIT_MIR default_boxed_slice.main.DataflowConstProp.diff
13
+
14
+ // CHECK-LABEL: fn main(
14
15
fn main ( ) {
15
16
// ConstProp will create a constant of type `Box<[bool]>`.
16
17
// Verify that `DataflowConstProp` does not ICE trying to dereference it directly.
18
+
19
+ // CHECK: debug a => [[a:_.*]];
20
+ // CHECK: scope {{[0-9]+}} (inlined <Box<[bool]> as Default>::default) {
21
+ // CHECK: scope {{[0-9]+}} (inlined Unique::<[bool; 0]>::dangling) {
22
+ // CHECK: scope {{[0-9]+}} (inlined NonNull::<[bool; 0]>::dangling) {
23
+ // We may check other inlined functions as well...
24
+
25
+ // CHECK: bb{{[0-9]+}}: {
26
+ // CHECK: [[box_obj:_.*]] = Box::<[bool]>(_3, const std::alloc::Global);
27
+ // CHECK: [[a]] = A { foo: move [[box_obj]] };
17
28
let a: A = A { foo : Box :: default ( ) } ;
18
29
}
You can’t perform that action at this time.
0 commit comments