This repository was archived by the owner on May 28, 2025. It is now read-only.
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
21// unit-test: DataflowConstProp
32// compile-flags: -Coverflow-checks=on
43// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
54
65// EMIT_MIR checked.main.DataflowConstProp.diff
76#[ allow( arithmetic_overflow) ]
7+
8+ // CHECK-LABEL: fn main(
89fn 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;
917 let a = 1 ;
18+
19+ // CHECK: [[b]] = const 2_i32;
1020 let b = 2 ;
21+
22+ // CHECK: [[c]] = const 3_i32;
1123 let c = a + b;
1224
25+ // CHECK: [[d]] = const _;
1326 let d = i32:: MAX ;
27+
28+ // CHECK: [[e]] = const i32::MIN;
1429 let e = d + 1 ;
1530}
Original file line number Diff line number Diff line change 1- // skip-filecheck
21// unit-test: DataflowConstProp
32// compile-flags: -Zmir-enable-passes=+GVN,+Inline
43// ignore-debug assertions change the output MIR
@@ -11,8 +10,20 @@ struct A {
1110
1211// EMIT_MIR default_boxed_slice.main.GVN.diff
1312// EMIT_MIR default_boxed_slice.main.DataflowConstProp.diff
13+
14+ // CHECK-LABEL: fn main(
1415fn main ( ) {
1516 // ConstProp will create a constant of type `Box<[bool]>`.
1617 // 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]] };
1728 let a: A = A { foo : Box :: default ( ) } ;
1829}
You can’t perform that action at this time.
0 commit comments