Skip to content

Commit 7b145a8

Browse files
CoAlloc: tests/mir-opt updated
1 parent 7b88fd4 commit 7b145a8

File tree

3 files changed

+107
-25
lines changed

3 files changed

+107
-25
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
- // MIR for `main` before Inline
2+
+ // MIR for `main` after Inline
3+
4+
fn main() -> () {
5+
let mut _0: (); // return place in scope 0 at $DIR/inline_into_box_place.rs:+0:11: +0:11
6+
let _1: std::boxed::Box<std::vec::Vec<u32>>; // in scope 0 at $DIR/inline_into_box_place.rs:+1:9: +1:11
7+
let mut _2: std::vec::Vec<u32>; // in scope 0 at $DIR/inline_into_box_place.rs:+1:38: +1:48
8+
scope 1 {
9+
debug _x => _1; // in scope 1 at $DIR/inline_into_box_place.rs:+1:9: +1:11
10+
}
11+
+ scope 2 (inlined Vec::<u32>::new) { // at $DIR/inline_into_box_place.rs:8:38: 8:48
12+
+ scope 3 (inlined Vec::<u32>::new_co) { // at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL
13+
+ let mut _3: alloc::raw_vec::RawVec<u32>; // in scope 3 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL
14+
+ }
15+
+ }
16+
+ scope 4 (inlined Box::<Vec<u32>>::new) { // at $DIR/inline_into_box_place.rs:8:29: 8:49
17+
+ debug x => _2; // in scope 4 at $SRC_DIR/alloc/src/boxed.rs:LL:COL
18+
+ let mut _4: usize; // in scope 4 at $SRC_DIR/alloc/src/boxed.rs:LL:COL
19+
+ let mut _5: usize; // in scope 4 at $SRC_DIR/alloc/src/boxed.rs:LL:COL
20+
+ let mut _6: *mut u8; // in scope 4 at $SRC_DIR/alloc/src/boxed.rs:LL:COL
21+
+ let mut _7: *const std::vec::Vec<u32>; // in scope 4 at $SRC_DIR/alloc/src/boxed.rs:LL:COL
22+
+ scope 5 {
23+
+ }
24+
+ }
25+
26+
bb0: {
27+
StorageLive(_1); // scope 0 at $DIR/inline_into_box_place.rs:+1:9: +1:11
28+
StorageLive(_2); // scope 0 at $DIR/inline_into_box_place.rs:+1:38: +1:48
29+
- _2 = Vec::<u32>::new() -> bb1; // scope 0 at $DIR/inline_into_box_place.rs:+1:38: +1:48
30+
+ StorageLive(_3); // scope 3 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL
31+
+ _3 = const _; // scope 3 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL
32+
// mir::Constant
33+
- // + span: $DIR/inline_into_box_place.rs:8:38: 8:46
34+
- // + user_ty: UserType(2)
35+
- // + literal: Const { ty: fn() -> Vec<u32> {Vec::<u32>::new}, val: Value(<ZST>) }
36+
+ // + span: $SRC_DIR/alloc/src/vec/mod.rs:LL:COL
37+
+ // + user_ty: UserType(0)
38+
+ // + literal: Const { ty: alloc::raw_vec::RawVec<u32>, val: Unevaluated(alloc::raw_vec::RawVec::<T, std::alloc::Global, CO_ALLOC_PREF>::NEW, [u32, Const { ty: usize, kind: Value(Leaf(0x00000000)) }], None) }
39+
+ _2 = Vec::<u32> { buf: move _3, len: const 0_usize }; // scope 3 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL
40+
+ StorageDead(_3); // scope 3 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL
41+
+ _4 = SizeOf(std::vec::Vec<u32>); // scope 5 at $SRC_DIR/alloc/src/boxed.rs:LL:COL
42+
+ _5 = AlignOf(std::vec::Vec<u32>); // scope 5 at $SRC_DIR/alloc/src/boxed.rs:LL:COL
43+
+ _6 = alloc::alloc::exchange_malloc(move _4, move _5) -> [return: bb3, unwind: bb4]; // scope 5 at $SRC_DIR/alloc/src/boxed.rs:LL:COL
44+
+ // mir::Constant
45+
+ // + span: $SRC_DIR/alloc/src/boxed.rs:LL:COL
46+
+ // + literal: Const { ty: unsafe fn(usize, usize) -> *mut u8 {alloc::alloc::exchange_malloc}, val: Value(<ZST>) }
47+
}
48+
49+
bb1: {
50+
- _1 = Box::<Vec<u32>>::new(move _2) -> [return: bb2, unwind: bb4]; // scope 0 at $DIR/inline_into_box_place.rs:+1:29: +1:49
51+
- // mir::Constant
52+
- // + span: $DIR/inline_into_box_place.rs:8:29: 8:37
53+
- // + user_ty: UserType(1)
54+
- // + literal: Const { ty: fn(Vec<u32>) -> Box<Vec<u32>> {Box::<Vec<u32>>::new}, val: Value(<ZST>) }
55+
+ StorageDead(_1); // scope 0 at $DIR/inline_into_box_place.rs:+2:1: +2:2
56+
+ return; // scope 0 at $DIR/inline_into_box_place.rs:+2:2: +2:2
57+
}
58+
59+
- bb2: {
60+
- StorageDead(_2); // scope 0 at $DIR/inline_into_box_place.rs:+1:48: +1:49
61+
- _0 = const (); // scope 0 at $DIR/inline_into_box_place.rs:+0:11: +2:2
62+
- drop(_1) -> [return: bb3, unwind: bb4]; // scope 0 at $DIR/inline_into_box_place.rs:+2:1: +2:2
63+
+ bb2 (cleanup): {
64+
+ resume; // scope 0 at $DIR/inline_into_box_place.rs:+0:1: +2:2
65+
}
66+
67+
bb3: {
68+
- StorageDead(_1); // scope 0 at $DIR/inline_into_box_place.rs:+2:1: +2:2
69+
- return; // scope 0 at $DIR/inline_into_box_place.rs:+2:2: +2:2
70+
+ _1 = ShallowInitBox(move _6, std::vec::Vec<u32>); // scope 4 at $SRC_DIR/alloc/src/boxed.rs:LL:COL
71+
+ _7 = (((_1.0: std::ptr::Unique<std::vec::Vec<u32>>).0: std::ptr::NonNull<std::vec::Vec<u32>>).0: *const std::vec::Vec<u32>); // scope 4 at $SRC_DIR/alloc/src/boxed.rs:LL:COL
72+
+ (*_7) = move _2; // scope 4 at $SRC_DIR/alloc/src/boxed.rs:LL:COL
73+
+ StorageDead(_2); // scope 0 at $DIR/inline_into_box_place.rs:+1:48: +1:49
74+
+ _0 = const (); // scope 0 at $DIR/inline_into_box_place.rs:+0:11: +2:2
75+
+ drop(_1) -> [return: bb1, unwind: bb2]; // scope 0 at $DIR/inline_into_box_place.rs:+2:1: +2:2
76+
}
77+
78+
bb4 (cleanup): {
79+
- resume; // scope 0 at $DIR/inline_into_box_place.rs:+0:1: +2:2
80+
+ drop(_2) -> bb2; // scope 4 at $SRC_DIR/alloc/src/boxed.rs:LL:COL
81+
}
82+
}
83+

tests/mir-opt/inline/inline_into_box_place.main.Inline.diff renamed to tests/mir-opt/inline/inline_into_box_place.main.Inline.64bit.diff

+23-25
Original file line numberDiff line numberDiff line change
@@ -8,41 +8,39 @@
88
scope 1 {
99
debug _x => _1; // in scope 1 at $DIR/inline_into_box_place.rs:+1:9: +1:11
1010
}
11-
+ scope 2 (inlined Vec::<u32>::new) { // at $DIR/inline_into_box_place.rs:7:38: 7:48
12-
+ scope 3 {
13-
+ scope 4 (inlined Vec::<u32>::new_co) { // at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL
14-
+ let mut _3: alloc::raw_vec::RawVec<u32>; // in scope 4 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL
15-
+ }
11+
+ scope 2 (inlined Vec::<u32>::new) { // at $DIR/inline_into_box_place.rs:8:38: 8:48
12+
+ scope 3 (inlined Vec::<u32>::new_co) { // at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL
13+
+ let mut _3: alloc::raw_vec::RawVec<u32>; // in scope 3 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL
1614
+ }
1715
+ }
18-
+ scope 5 (inlined Box::<Vec<u32>>::new) { // at $DIR/inline_into_box_place.rs:7:29: 7:49
19-
+ debug x => _2; // in scope 5 at $SRC_DIR/alloc/src/boxed.rs:LL:COL
20-
+ let mut _4: usize; // in scope 5 at $SRC_DIR/alloc/src/boxed.rs:LL:COL
21-
+ let mut _5: usize; // in scope 5 at $SRC_DIR/alloc/src/boxed.rs:LL:COL
22-
+ let mut _6: *mut u8; // in scope 5 at $SRC_DIR/alloc/src/boxed.rs:LL:COL
23-
+ let mut _7: *const std::vec::Vec<u32>; // in scope 5 at $SRC_DIR/alloc/src/boxed.rs:LL:COL
24-
+ scope 6 {
16+
+ scope 4 (inlined Box::<Vec<u32>>::new) { // at $DIR/inline_into_box_place.rs:8:29: 8:49
17+
+ debug x => _2; // in scope 4 at $SRC_DIR/alloc/src/boxed.rs:LL:COL
18+
+ let mut _4: usize; // in scope 4 at $SRC_DIR/alloc/src/boxed.rs:LL:COL
19+
+ let mut _5: usize; // in scope 4 at $SRC_DIR/alloc/src/boxed.rs:LL:COL
20+
+ let mut _6: *mut u8; // in scope 4 at $SRC_DIR/alloc/src/boxed.rs:LL:COL
21+
+ let mut _7: *const std::vec::Vec<u32>; // in scope 4 at $SRC_DIR/alloc/src/boxed.rs:LL:COL
22+
+ scope 5 {
2523
+ }
2624
+ }
2725

2826
bb0: {
2927
StorageLive(_1); // scope 0 at $DIR/inline_into_box_place.rs:+1:9: +1:11
3028
StorageLive(_2); // scope 0 at $DIR/inline_into_box_place.rs:+1:38: +1:48
3129
- _2 = Vec::<u32>::new() -> bb1; // scope 0 at $DIR/inline_into_box_place.rs:+1:38: +1:48
32-
+ StorageLive(_3); // scope 4 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL
33-
+ _3 = const _; // scope 4 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL
30+
+ StorageLive(_3); // scope 3 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL
31+
+ _3 = const _; // scope 3 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL
3432
// mir::Constant
35-
- // + span: $DIR/inline_into_box_place.rs:7:38: 7:46
33+
- // + span: $DIR/inline_into_box_place.rs:8:38: 8:46
3634
- // + user_ty: UserType(2)
3735
- // + literal: Const { ty: fn() -> Vec<u32> {Vec::<u32>::new}, val: Value(<ZST>) }
3836
+ // + span: $SRC_DIR/alloc/src/vec/mod.rs:LL:COL
3937
+ // + user_ty: UserType(0)
4038
+ // + literal: Const { ty: alloc::raw_vec::RawVec<u32>, val: Unevaluated(alloc::raw_vec::RawVec::<T, std::alloc::Global, CO_ALLOC_PREF>::NEW, [u32, Const { ty: usize, kind: Value(Leaf(0x0000000000000000)) }], None) }
41-
+ _2 = Vec::<u32> { buf: move _3, len: const 0_usize }; // scope 4 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL
42-
+ StorageDead(_3); // scope 4 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL
43-
+ _4 = SizeOf(std::vec::Vec<u32>); // scope 6 at $SRC_DIR/alloc/src/boxed.rs:LL:COL
44-
+ _5 = AlignOf(std::vec::Vec<u32>); // scope 6 at $SRC_DIR/alloc/src/boxed.rs:LL:COL
45-
+ _6 = alloc::alloc::exchange_malloc(move _4, move _5) -> [return: bb3, unwind: bb4]; // scope 6 at $SRC_DIR/alloc/src/boxed.rs:LL:COL
39+
+ _2 = Vec::<u32> { buf: move _3, len: const 0_usize }; // scope 3 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL
40+
+ StorageDead(_3); // scope 3 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL
41+
+ _4 = SizeOf(std::vec::Vec<u32>); // scope 5 at $SRC_DIR/alloc/src/boxed.rs:LL:COL
42+
+ _5 = AlignOf(std::vec::Vec<u32>); // scope 5 at $SRC_DIR/alloc/src/boxed.rs:LL:COL
43+
+ _6 = alloc::alloc::exchange_malloc(move _4, move _5) -> [return: bb3, unwind: bb4]; // scope 5 at $SRC_DIR/alloc/src/boxed.rs:LL:COL
4644
+ // mir::Constant
4745
+ // + span: $SRC_DIR/alloc/src/boxed.rs:LL:COL
4846
+ // + literal: Const { ty: unsafe fn(usize, usize) -> *mut u8 {alloc::alloc::exchange_malloc}, val: Value(<ZST>) }
@@ -51,7 +49,7 @@
5149
bb1: {
5250
- _1 = Box::<Vec<u32>>::new(move _2) -> [return: bb2, unwind: bb4]; // scope 0 at $DIR/inline_into_box_place.rs:+1:29: +1:49
5351
- // mir::Constant
54-
- // + span: $DIR/inline_into_box_place.rs:7:29: 7:37
52+
- // + span: $DIR/inline_into_box_place.rs:8:29: 8:37
5553
- // + user_ty: UserType(1)
5654
- // + literal: Const { ty: fn(Vec<u32>) -> Box<Vec<u32>> {Box::<Vec<u32>>::new}, val: Value(<ZST>) }
5755
+ StorageDead(_1); // scope 0 at $DIR/inline_into_box_place.rs:+2:1: +2:2
@@ -69,17 +67,17 @@
6967
bb3: {
7068
- StorageDead(_1); // scope 0 at $DIR/inline_into_box_place.rs:+2:1: +2:2
7169
- return; // scope 0 at $DIR/inline_into_box_place.rs:+2:2: +2:2
72-
+ _1 = ShallowInitBox(move _6, std::vec::Vec<u32>); // scope 5 at $SRC_DIR/alloc/src/boxed.rs:LL:COL
73-
+ _7 = (((_1.0: std::ptr::Unique<std::vec::Vec<u32>>).0: std::ptr::NonNull<std::vec::Vec<u32>>).0: *const std::vec::Vec<u32>); // scope 5 at $SRC_DIR/alloc/src/boxed.rs:LL:COL
74-
+ (*_7) = move _2; // scope 5 at $SRC_DIR/alloc/src/boxed.rs:LL:COL
70+
+ _1 = ShallowInitBox(move _6, std::vec::Vec<u32>); // scope 4 at $SRC_DIR/alloc/src/boxed.rs:LL:COL
71+
+ _7 = (((_1.0: std::ptr::Unique<std::vec::Vec<u32>>).0: std::ptr::NonNull<std::vec::Vec<u32>>).0: *const std::vec::Vec<u32>); // scope 4 at $SRC_DIR/alloc/src/boxed.rs:LL:COL
72+
+ (*_7) = move _2; // scope 4 at $SRC_DIR/alloc/src/boxed.rs:LL:COL
7573
+ StorageDead(_2); // scope 0 at $DIR/inline_into_box_place.rs:+1:48: +1:49
7674
+ _0 = const (); // scope 0 at $DIR/inline_into_box_place.rs:+0:11: +2:2
7775
+ drop(_1) -> [return: bb1, unwind: bb2]; // scope 0 at $DIR/inline_into_box_place.rs:+2:1: +2:2
7876
}
7977

8078
bb4 (cleanup): {
8179
- resume; // scope 0 at $DIR/inline_into_box_place.rs:+0:1: +2:2
82-
+ drop(_2) -> bb2; // scope 5 at $SRC_DIR/alloc/src/boxed.rs:LL:COL
80+
+ drop(_2) -> bb2; // scope 4 at $SRC_DIR/alloc/src/boxed.rs:LL:COL
8381
}
8482
}
8583

tests/mir-opt/inline/inline_into_box_place.rs

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// ignore-wasm32-bare compiled with panic=abort by default
33
// compile-flags: -Z mir-opt-level=4
44

5+
// EMIT_MIR_FOR_EACH_BIT_WIDTH
56
// EMIT_MIR inline_into_box_place.main.Inline.diff
67
fn main() {
78
let _x: Box<Vec<u32>> = Box::new(Vec::new());

0 commit comments

Comments
 (0)