-
Notifications
You must be signed in to change notification settings - Fork 13k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GVN away PtrToPtr-then-Transmute when possible
- Loading branch information
Showing
6 changed files
with
165 additions
and
35 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
47 changes: 47 additions & 0 deletions
47
tests/mir-opt/gvn.cast_pointer_then_transmute.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,47 @@ | ||
- // MIR for `cast_pointer_then_transmute` before GVN | ||
+ // MIR for `cast_pointer_then_transmute` after GVN | ||
|
||
fn cast_pointer_then_transmute(_1: *mut u32, _2: *mut [u8]) -> () { | ||
debug thin => _1; | ||
debug fat => _2; | ||
let mut _0: (); | ||
let _3: usize; | ||
let mut _4: *const (); | ||
let mut _5: *mut u32; | ||
let mut _7: *const (); | ||
let mut _8: *mut [u8]; | ||
scope 1 { | ||
debug thin_addr => _3; | ||
let _6: usize; | ||
scope 2 { | ||
debug fat_addr => _6; | ||
} | ||
} | ||
|
||
bb0: { | ||
StorageLive(_3); | ||
StorageLive(_4); | ||
StorageLive(_5); | ||
_5 = _1; | ||
- _4 = move _5 as *const () (PtrToPtr); | ||
+ _4 = _1 as *const () (PtrToPtr); | ||
StorageDead(_5); | ||
- _3 = move _4 as usize (Transmute); | ||
+ _3 = _1 as usize (Transmute); | ||
StorageDead(_4); | ||
StorageLive(_6); | ||
StorageLive(_7); | ||
StorageLive(_8); | ||
_8 = _2; | ||
- _7 = move _8 as *const () (PtrToPtr); | ||
+ _7 = _2 as *const () (PtrToPtr); | ||
StorageDead(_8); | ||
_6 = move _7 as usize (Transmute); | ||
StorageDead(_7); | ||
_0 = const (); | ||
StorageDead(_6); | ||
StorageDead(_3); | ||
return; | ||
} | ||
} | ||
|
47 changes: 47 additions & 0 deletions
47
tests/mir-opt/gvn.cast_pointer_then_transmute.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,47 @@ | ||
- // MIR for `cast_pointer_then_transmute` before GVN | ||
+ // MIR for `cast_pointer_then_transmute` after GVN | ||
|
||
fn cast_pointer_then_transmute(_1: *mut u32, _2: *mut [u8]) -> () { | ||
debug thin => _1; | ||
debug fat => _2; | ||
let mut _0: (); | ||
let _3: usize; | ||
let mut _4: *const (); | ||
let mut _5: *mut u32; | ||
let mut _7: *const (); | ||
let mut _8: *mut [u8]; | ||
scope 1 { | ||
debug thin_addr => _3; | ||
let _6: usize; | ||
scope 2 { | ||
debug fat_addr => _6; | ||
} | ||
} | ||
|
||
bb0: { | ||
StorageLive(_3); | ||
StorageLive(_4); | ||
StorageLive(_5); | ||
_5 = _1; | ||
- _4 = move _5 as *const () (PtrToPtr); | ||
+ _4 = _1 as *const () (PtrToPtr); | ||
StorageDead(_5); | ||
- _3 = move _4 as usize (Transmute); | ||
+ _3 = _1 as usize (Transmute); | ||
StorageDead(_4); | ||
StorageLive(_6); | ||
StorageLive(_7); | ||
StorageLive(_8); | ||
_8 = _2; | ||
- _7 = move _8 as *const () (PtrToPtr); | ||
+ _7 = _2 as *const () (PtrToPtr); | ||
StorageDead(_8); | ||
_6 = move _7 as usize (Transmute); | ||
StorageDead(_7); | ||
_0 = const (); | ||
StorageDead(_6); | ||
StorageDead(_3); | ||
return; | ||
} | ||
} | ||
|
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
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
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