File tree Expand file tree Collapse file tree 2 files changed +102
-0
lines changed Expand file tree Collapse file tree 2 files changed +102
-0
lines changed Original file line number Diff line number Diff line change 1+ // skip-filecheck
2+ //@ compile-flags: -Zmir-enable-passes=+Inline,+GVN --crate-type lib
3+ // EMIT_MIR dont_reset_cast_kind_without_updating_operand.test.GVN.diff
4+
5+ fn test ( ) {
6+ let vp_ctx: & Box < ( ) > = & Box :: new ( ( ) ) ;
7+ let slf: * const ( ) = & raw const * * vp_ctx;
8+ let bytes = std:: ptr:: slice_from_raw_parts ( slf, 1 ) ;
9+ let _x = foo ( bytes) ;
10+ }
11+
12+ fn foo ( bytes : * const [ ( ) ] ) -> * mut ( ) {
13+ bytes as * mut ( )
14+ }
Original file line number Diff line number Diff line change 1+ - // MIR for `test` before GVN
2+ + // MIR for `test` after GVN
3+
4+ fn test() -> () {
5+ let mut _0: ();
6+ let _1: &std::boxed::Box<()>;
7+ let _2: &std::boxed::Box<()>;
8+ let _3: std::boxed::Box<()>;
9+ let mut _6: *const ();
10+ let mut _8: *const [()];
11+ let mut _9: std::boxed::Box<()>;
12+ let mut _10: *const ();
13+ let mut _11: usize;
14+ scope 1 {
15+ debug vp_ctx => _1;
16+ let _4: *const ();
17+ scope 2 {
18+ debug slf => _10;
19+ let _5: *const [()];
20+ scope 3 {
21+ debug bytes => _5;
22+ let _7: *mut ();
23+ scope 4 {
24+ debug _x => _7;
25+ }
26+ scope 7 (inlined foo) {
27+ }
28+ }
29+ scope 5 (inlined slice_from_raw_parts::<()>) {
30+ scope 6 (inlined std::ptr::from_raw_parts::<[()], ()>) {
31+ }
32+ }
33+ }
34+ }
35+
36+ bb0: {
37+ StorageLive(_1);
38+ - StorageLive(_2);
39+ + nop;
40+ StorageLive(_3);
41+ _3 = Box::<()>::new(const ()) -> [return: bb1, unwind continue];
42+ }
43+
44+ bb1: {
45+ _2 = &_3;
46+ _1 = copy _2;
47+ - StorageDead(_2);
48+ + nop;
49+ StorageLive(_4);
50+ - _9 = deref_copy _3;
51+ + _9 = copy _3;
52+ _10 = copy ((_9.0: std::ptr::Unique<()>).0: std::ptr::NonNull<()>) as *const () (Transmute);
53+ _4 = copy _10;
54+ - StorageLive(_5);
55+ + nop;
56+ StorageLive(_6);
57+ - _6 = copy _4;
58+ + _6 = copy _10;
59+ StorageLive(_11);
60+ _11 = const 1_usize;
61+ - _5 = *const [()] from (copy _6, copy _11);
62+ + _5 = *const [()] from (copy _10, const 1_usize);
63+ StorageDead(_11);
64+ StorageDead(_6);
65+ StorageLive(_7);
66+ StorageLive(_8);
67+ _8 = copy _5;
68+ - _7 = copy _8 as *mut () (PtrToPtr);
69+ + _7 = copy _5 as *mut () (Transmute);
70+ StorageDead(_8);
71+ StorageDead(_7);
72+ - StorageDead(_5);
73+ + nop;
74+ StorageDead(_4);
75+ drop(_3) -> [return: bb2, unwind: bb3];
76+ }
77+
78+ bb2: {
79+ StorageDead(_3);
80+ StorageDead(_1);
81+ return;
82+ }
83+
84+ bb3 (cleanup): {
85+ resume;
86+ }
87+ }
88+
You can’t perform that action at this time.
0 commit comments