-
Notifications
You must be signed in to change notification settings - Fork 13.4k
[libs] Simplify unchecked_{shl,shr}
#112724
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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
36 changes: 36 additions & 0 deletions
36
tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_bigger.Inline.panic-abort.diff
This file contains hidden or 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,36 @@ | ||
- // MIR for `unchecked_shl_unsigned_bigger` before Inline | ||
+ // MIR for `unchecked_shl_unsigned_bigger` after Inline | ||
|
||
fn unchecked_shl_unsigned_bigger(_1: u64, _2: u32) -> u64 { | ||
debug a => _1; | ||
debug b => _2; | ||
let mut _0: u64; | ||
let mut _3: u64; | ||
let mut _4: u32; | ||
+ scope 1 (inlined core::num::<impl u64>::unchecked_shl) { | ||
+ debug self => _3; | ||
+ debug rhs => _4; | ||
+ let mut _5: u64; | ||
+ scope 2 { | ||
+ } | ||
+ } | ||
|
||
bb0: { | ||
StorageLive(_3); | ||
_3 = _1; | ||
StorageLive(_4); | ||
_4 = _2; | ||
- _0 = core::num::<impl u64>::unchecked_shl(move _3, move _4) -> [return: bb1, unwind unreachable]; | ||
+ StorageLive(_5); | ||
+ _5 = _4 as u64 (IntToInt); | ||
+ _0 = unchecked_shl::<u64>(_3, move _5) -> [return: bb1, unwind unreachable]; | ||
} | ||
|
||
bb1: { | ||
+ StorageDead(_5); | ||
StorageDead(_4); | ||
StorageDead(_3); | ||
return; | ||
} | ||
} | ||
|
36 changes: 36 additions & 0 deletions
36
tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_bigger.Inline.panic-unwind.diff
This file contains hidden or 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,36 @@ | ||
- // MIR for `unchecked_shl_unsigned_bigger` before Inline | ||
+ // MIR for `unchecked_shl_unsigned_bigger` after Inline | ||
|
||
fn unchecked_shl_unsigned_bigger(_1: u64, _2: u32) -> u64 { | ||
debug a => _1; | ||
debug b => _2; | ||
let mut _0: u64; | ||
let mut _3: u64; | ||
let mut _4: u32; | ||
+ scope 1 (inlined core::num::<impl u64>::unchecked_shl) { | ||
+ debug self => _3; | ||
+ debug rhs => _4; | ||
+ let mut _5: u64; | ||
+ scope 2 { | ||
+ } | ||
+ } | ||
|
||
bb0: { | ||
StorageLive(_3); | ||
_3 = _1; | ||
StorageLive(_4); | ||
_4 = _2; | ||
- _0 = core::num::<impl u64>::unchecked_shl(move _3, move _4) -> bb1; | ||
+ StorageLive(_5); | ||
+ _5 = _4 as u64 (IntToInt); | ||
+ _0 = unchecked_shl::<u64>(_3, move _5) -> [return: bb1, unwind unreachable]; | ||
} | ||
|
||
bb1: { | ||
+ StorageDead(_5); | ||
StorageDead(_4); | ||
StorageDead(_3); | ||
return; | ||
} | ||
} | ||
|
25 changes: 25 additions & 0 deletions
25
...pt/inline/unchecked_shifts.unchecked_shl_unsigned_bigger.PreCodegen.after.panic-abort.mir
This file contains hidden or 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,25 @@ | ||
// MIR for `unchecked_shl_unsigned_bigger` after PreCodegen | ||
|
||
fn unchecked_shl_unsigned_bigger(_1: u64, _2: u32) -> u64 { | ||
debug a => _1; | ||
debug b => _2; | ||
let mut _0: u64; | ||
scope 1 (inlined core::num::<impl u64>::unchecked_shl) { | ||
debug self => _1; | ||
debug rhs => _2; | ||
let mut _3: u64; | ||
scope 2 { | ||
} | ||
} | ||
|
||
bb0: { | ||
StorageLive(_3); | ||
_3 = _2 as u64 (IntToInt); | ||
_0 = unchecked_shl::<u64>(_1, move _3) -> [return: bb1, unwind unreachable]; | ||
} | ||
|
||
bb1: { | ||
StorageDead(_3); | ||
return; | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
...t/inline/unchecked_shifts.unchecked_shl_unsigned_bigger.PreCodegen.after.panic-unwind.mir
This file contains hidden or 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,25 @@ | ||
// MIR for `unchecked_shl_unsigned_bigger` after PreCodegen | ||
|
||
fn unchecked_shl_unsigned_bigger(_1: u64, _2: u32) -> u64 { | ||
debug a => _1; | ||
debug b => _2; | ||
let mut _0: u64; | ||
scope 1 (inlined core::num::<impl u64>::unchecked_shl) { | ||
debug self => _1; | ||
debug rhs => _2; | ||
let mut _3: u64; | ||
scope 2 { | ||
} | ||
} | ||
|
||
bb0: { | ||
StorageLive(_3); | ||
_3 = _2 as u64 (IntToInt); | ||
_0 = unchecked_shl::<u64>(_1, move _3) -> [return: bb1, unwind unreachable]; | ||
} | ||
|
||
bb1: { | ||
StorageDead(_3); | ||
return; | ||
} | ||
} |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
36 changes: 36 additions & 0 deletions
36
tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_bigger.Inline.panic-abort.diff
This file contains hidden or 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,36 @@ | ||
- // MIR for `unchecked_shr_signed_bigger` before Inline | ||
+ // MIR for `unchecked_shr_signed_bigger` after Inline | ||
|
||
fn unchecked_shr_signed_bigger(_1: i64, _2: u32) -> i64 { | ||
debug a => _1; | ||
debug b => _2; | ||
let mut _0: i64; | ||
let mut _3: i64; | ||
let mut _4: u32; | ||
+ scope 1 (inlined core::num::<impl i64>::unchecked_shr) { | ||
+ debug self => _3; | ||
+ debug rhs => _4; | ||
+ let mut _5: i64; | ||
+ scope 2 { | ||
+ } | ||
+ } | ||
|
||
bb0: { | ||
StorageLive(_3); | ||
_3 = _1; | ||
StorageLive(_4); | ||
_4 = _2; | ||
- _0 = core::num::<impl i64>::unchecked_shr(move _3, move _4) -> [return: bb1, unwind unreachable]; | ||
+ StorageLive(_5); | ||
+ _5 = _4 as i64 (IntToInt); | ||
+ _0 = unchecked_shr::<i64>(_3, move _5) -> [return: bb1, unwind unreachable]; | ||
} | ||
|
||
bb1: { | ||
+ StorageDead(_5); | ||
StorageDead(_4); | ||
StorageDead(_3); | ||
return; | ||
} | ||
} | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.