-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable GVN for
AggregateKind::RawPtr
& UnOp::PtrMetadata
- Loading branch information
Showing
14 changed files
with
519 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
tests/mir-opt/gvn.casts_before_aggregate_raw_ptr.GVN.panic-abort.diff
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
- // MIR for `casts_before_aggregate_raw_ptr` before GVN | ||
+ // MIR for `casts_before_aggregate_raw_ptr` after GVN | ||
|
||
fn casts_before_aggregate_raw_ptr(_1: *const u32) -> *const [u8] { | ||
debug x => _1; | ||
let mut _0: *const [u8]; | ||
let _2: *const [u8; 4]; | ||
let mut _3: *const u32; | ||
let mut _5: *const [u8; 4]; | ||
let mut _7: *const u8; | ||
let mut _8: *const (); | ||
scope 1 { | ||
debug x => _2; | ||
let _4: *const u8; | ||
scope 2 { | ||
debug x => _4; | ||
let _6: *const (); | ||
scope 3 { | ||
debug x => _6; | ||
} | ||
} | ||
} | ||
|
||
bb0: { | ||
- StorageLive(_2); | ||
+ nop; | ||
StorageLive(_3); | ||
_3 = _1; | ||
- _2 = move _3 as *const [u8; 4] (PtrToPtr); | ||
+ _2 = _1 as *const [u8; 4] (PtrToPtr); | ||
StorageDead(_3); | ||
- StorageLive(_4); | ||
+ nop; | ||
StorageLive(_5); | ||
_5 = _2; | ||
- _4 = move _5 as *const u8 (PtrToPtr); | ||
+ _4 = _1 as *const u8 (PtrToPtr); | ||
StorageDead(_5); | ||
- StorageLive(_6); | ||
+ nop; | ||
StorageLive(_7); | ||
_7 = _4; | ||
- _6 = move _7 as *const () (PtrToPtr); | ||
+ _6 = _1 as *const () (PtrToPtr); | ||
StorageDead(_7); | ||
StorageLive(_8); | ||
_8 = _6; | ||
- _0 = *const [u8] from (move _8, const 4_usize); | ||
+ _0 = *const [u8] from (_1, const 4_usize); | ||
StorageDead(_8); | ||
- StorageDead(_6); | ||
- StorageDead(_4); | ||
- StorageDead(_2); | ||
+ nop; | ||
+ nop; | ||
+ nop; | ||
return; | ||
} | ||
} | ||
|
60 changes: 60 additions & 0 deletions
60
tests/mir-opt/gvn.casts_before_aggregate_raw_ptr.GVN.panic-unwind.diff
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
- // MIR for `casts_before_aggregate_raw_ptr` before GVN | ||
+ // MIR for `casts_before_aggregate_raw_ptr` after GVN | ||
|
||
fn casts_before_aggregate_raw_ptr(_1: *const u32) -> *const [u8] { | ||
debug x => _1; | ||
let mut _0: *const [u8]; | ||
let _2: *const [u8; 4]; | ||
let mut _3: *const u32; | ||
let mut _5: *const [u8; 4]; | ||
let mut _7: *const u8; | ||
let mut _8: *const (); | ||
scope 1 { | ||
debug x => _2; | ||
let _4: *const u8; | ||
scope 2 { | ||
debug x => _4; | ||
let _6: *const (); | ||
scope 3 { | ||
debug x => _6; | ||
} | ||
} | ||
} | ||
|
||
bb0: { | ||
- StorageLive(_2); | ||
+ nop; | ||
StorageLive(_3); | ||
_3 = _1; | ||
- _2 = move _3 as *const [u8; 4] (PtrToPtr); | ||
+ _2 = _1 as *const [u8; 4] (PtrToPtr); | ||
StorageDead(_3); | ||
- StorageLive(_4); | ||
+ nop; | ||
StorageLive(_5); | ||
_5 = _2; | ||
- _4 = move _5 as *const u8 (PtrToPtr); | ||
+ _4 = _1 as *const u8 (PtrToPtr); | ||
StorageDead(_5); | ||
- StorageLive(_6); | ||
+ nop; | ||
StorageLive(_7); | ||
_7 = _4; | ||
- _6 = move _7 as *const () (PtrToPtr); | ||
+ _6 = _1 as *const () (PtrToPtr); | ||
StorageDead(_7); | ||
StorageLive(_8); | ||
_8 = _6; | ||
- _0 = *const [u8] from (move _8, const 4_usize); | ||
+ _0 = *const [u8] from (_1, const 4_usize); | ||
StorageDead(_8); | ||
- StorageDead(_6); | ||
- StorageDead(_4); | ||
- StorageDead(_2); | ||
+ nop; | ||
+ nop; | ||
+ nop; | ||
return; | ||
} | ||
} | ||
|
32 changes: 32 additions & 0 deletions
32
tests/mir-opt/gvn.meta_of_ref_to_slice.GVN.panic-abort.diff
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
- // MIR for `meta_of_ref_to_slice` before GVN | ||
+ // MIR for `meta_of_ref_to_slice` after GVN | ||
|
||
fn meta_of_ref_to_slice(_1: *const i32) -> usize { | ||
debug x => _1; | ||
let mut _0: usize; | ||
let _2: *const [i32]; | ||
let mut _3: *const i32; | ||
let mut _4: *const [i32]; | ||
scope 1 { | ||
debug ptr => _2; | ||
} | ||
|
||
bb0: { | ||
- StorageLive(_2); | ||
+ nop; | ||
StorageLive(_3); | ||
_3 = _1; | ||
- _2 = *const [i32] from (move _3, const 1_usize); | ||
+ _2 = *const [i32] from (_1, const 1_usize); | ||
StorageDead(_3); | ||
StorageLive(_4); | ||
_4 = _2; | ||
- _0 = PtrMetadata(move _4); | ||
+ _0 = const 1_usize; | ||
StorageDead(_4); | ||
- StorageDead(_2); | ||
+ nop; | ||
return; | ||
} | ||
} | ||
|
32 changes: 32 additions & 0 deletions
32
tests/mir-opt/gvn.meta_of_ref_to_slice.GVN.panic-unwind.diff
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
- // MIR for `meta_of_ref_to_slice` before GVN | ||
+ // MIR for `meta_of_ref_to_slice` after GVN | ||
|
||
fn meta_of_ref_to_slice(_1: *const i32) -> usize { | ||
debug x => _1; | ||
let mut _0: usize; | ||
let _2: *const [i32]; | ||
let mut _3: *const i32; | ||
let mut _4: *const [i32]; | ||
scope 1 { | ||
debug ptr => _2; | ||
} | ||
|
||
bb0: { | ||
- StorageLive(_2); | ||
+ nop; | ||
StorageLive(_3); | ||
_3 = _1; | ||
- _2 = *const [i32] from (move _3, const 1_usize); | ||
+ _2 = *const [i32] from (_1, const 1_usize); | ||
StorageDead(_3); | ||
StorageLive(_4); | ||
_4 = _2; | ||
- _0 = PtrMetadata(move _4); | ||
+ _0 = const 1_usize; | ||
StorageDead(_4); | ||
- StorageDead(_2); | ||
+ nop; | ||
return; | ||
} | ||
} | ||
|
Oops, something went wrong.