-
Notifications
You must be signed in to change notification settings - Fork 13.8k
Lower the assume intrinsic to a MIR statement #98332
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
+338
−570
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
3f07645
Lower the assume intrinsic to a MIR statement
oli-obk b741351
Generalize the Assume intrinsic statement to a general Intrinsic stat…
oli-obk 104f97e
Move CTFE handling of nondiverging intrinsics to intrinsics.rs
oli-obk 7348284
Update docs
oli-obk cd928b0
Test bump
oli-obk a0130e6
Check all operands, they may contain indirections in their place
oli-obk 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
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
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
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
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
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
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
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
26 changes: 26 additions & 0 deletions
26
src/test/mir-opt/lower_intrinsics.assume.LowerIntrinsics.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,26 @@ | ||
- // MIR for `assume` before LowerIntrinsics | ||
+ // MIR for `assume` after LowerIntrinsics | ||
|
||
fn assume() -> () { | ||
let mut _0: (); // return place in scope 0 at $DIR/lower_intrinsics.rs:+0:17: +0:17 | ||
let _1: (); // in scope 0 at $DIR/lower_intrinsics.rs:+2:9: +2:38 | ||
scope 1 { | ||
} | ||
|
||
bb0: { | ||
StorageLive(_1); // scope 1 at $DIR/lower_intrinsics.rs:+2:9: +2:38 | ||
- _1 = std::intrinsics::assume(const true) -> bb1; // scope 1 at $DIR/lower_intrinsics.rs:+2:9: +2:38 | ||
- // mir::Constant | ||
- // + span: $DIR/lower_intrinsics.rs:72:9: 72:32 | ||
- // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(bool) {std::intrinsics::assume}, val: Value(<ZST>) } | ||
+ assume(const true); // scope 1 at $DIR/lower_intrinsics.rs:+2:9: +2:38 | ||
+ goto -> bb1; // scope 1 at $DIR/lower_intrinsics.rs:+2:9: +2:38 | ||
} | ||
|
||
bb1: { | ||
StorageDead(_1); // scope 1 at $DIR/lower_intrinsics.rs:+2:38: +2:39 | ||
_0 = const (); // scope 1 at $DIR/lower_intrinsics.rs:+1:5: +3:6 | ||
return; // scope 0 at $DIR/lower_intrinsics.rs:+4:2: +4:2 | ||
} | ||
} | ||
|
72 changes: 72 additions & 0 deletions
72
src/test/mir-opt/lower_intrinsics.f_copy_nonoverlapping.LowerIntrinsics.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,72 @@ | ||
- // MIR for `f_copy_nonoverlapping` before LowerIntrinsics | ||
+ // MIR for `f_copy_nonoverlapping` after LowerIntrinsics | ||
|
||
fn f_copy_nonoverlapping() -> () { | ||
let mut _0: (); // return place in scope 0 at $DIR/lower_intrinsics.rs:+0:32: +0:32 | ||
let _1: (); // in scope 0 at $DIR/lower_intrinsics.rs:+1:9: +1:12 | ||
let _3: (); // in scope 0 at $DIR/lower_intrinsics.rs:+4:9: +4:95 | ||
let mut _4: *const i32; // in scope 0 at $DIR/lower_intrinsics.rs:+4:29: +4:59 | ||
let mut _5: *const (); // in scope 0 at $DIR/lower_intrinsics.rs:+4:29: +4:45 | ||
let mut _6: *const (); // in scope 0 at $DIR/lower_intrinsics.rs:+4:29: +4:45 | ||
let _7: &(); // in scope 0 at $DIR/lower_intrinsics.rs:+4:29: +4:33 | ||
let mut _8: *mut i32; // in scope 0 at $DIR/lower_intrinsics.rs:+4:61: +4:91 | ||
let mut _9: *mut (); // in scope 0 at $DIR/lower_intrinsics.rs:+4:61: +4:79 | ||
let mut _10: *mut (); // in scope 0 at $DIR/lower_intrinsics.rs:+4:61: +4:79 | ||
let mut _11: &mut (); // in scope 0 at $DIR/lower_intrinsics.rs:+4:61: +4:69 | ||
scope 1 { | ||
debug src => _1; // in scope 1 at $DIR/lower_intrinsics.rs:+1:9: +1:12 | ||
let mut _2: (); // in scope 1 at $DIR/lower_intrinsics.rs:+2:9: +2:16 | ||
scope 2 { | ||
debug dst => _2; // in scope 2 at $DIR/lower_intrinsics.rs:+2:9: +2:16 | ||
scope 3 { | ||
} | ||
} | ||
} | ||
|
||
bb0: { | ||
StorageLive(_1); // scope 0 at $DIR/lower_intrinsics.rs:+1:9: +1:12 | ||
Deinit(_1); // scope 0 at $DIR/lower_intrinsics.rs:+1:15: +1:17 | ||
StorageLive(_2); // scope 1 at $DIR/lower_intrinsics.rs:+2:9: +2:16 | ||
Deinit(_2); // scope 1 at $DIR/lower_intrinsics.rs:+2:19: +2:21 | ||
StorageLive(_3); // scope 3 at $DIR/lower_intrinsics.rs:+4:9: +4:95 | ||
StorageLive(_4); // scope 3 at $DIR/lower_intrinsics.rs:+4:29: +4:59 | ||
StorageLive(_5); // scope 3 at $DIR/lower_intrinsics.rs:+4:29: +4:45 | ||
StorageLive(_6); // scope 3 at $DIR/lower_intrinsics.rs:+4:29: +4:45 | ||
StorageLive(_7); // scope 3 at $DIR/lower_intrinsics.rs:+4:29: +4:33 | ||
_7 = &_1; // scope 3 at $DIR/lower_intrinsics.rs:+4:29: +4:33 | ||
_6 = &raw const (*_7); // scope 3 at $DIR/lower_intrinsics.rs:+4:29: +4:33 | ||
_5 = _6; // scope 3 at $DIR/lower_intrinsics.rs:+4:29: +4:45 | ||
_4 = move _5 as *const i32 (Misc); // scope 3 at $DIR/lower_intrinsics.rs:+4:29: +4:59 | ||
StorageDead(_5); // scope 3 at $DIR/lower_intrinsics.rs:+4:58: +4:59 | ||
StorageLive(_8); // scope 3 at $DIR/lower_intrinsics.rs:+4:61: +4:91 | ||
StorageLive(_9); // scope 3 at $DIR/lower_intrinsics.rs:+4:61: +4:79 | ||
StorageLive(_10); // scope 3 at $DIR/lower_intrinsics.rs:+4:61: +4:79 | ||
StorageLive(_11); // scope 3 at $DIR/lower_intrinsics.rs:+4:61: +4:69 | ||
_11 = &mut _2; // scope 3 at $DIR/lower_intrinsics.rs:+4:61: +4:69 | ||
_10 = &raw mut (*_11); // scope 3 at $DIR/lower_intrinsics.rs:+4:61: +4:69 | ||
_9 = _10; // scope 3 at $DIR/lower_intrinsics.rs:+4:61: +4:79 | ||
_8 = move _9 as *mut i32 (Misc); // scope 3 at $DIR/lower_intrinsics.rs:+4:61: +4:91 | ||
StorageDead(_9); // scope 3 at $DIR/lower_intrinsics.rs:+4:90: +4:91 | ||
- _3 = copy_nonoverlapping::<i32>(move _4, move _8, const 0_usize) -> bb1; // scope 3 at $DIR/lower_intrinsics.rs:+4:9: +4:95 | ||
- // mir::Constant | ||
- // + span: $DIR/lower_intrinsics.rs:65:9: 65:28 | ||
- // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(*const i32, *mut i32, usize) {copy_nonoverlapping::<i32>}, val: Value(<ZST>) } | ||
+ copy_nonoverlapping(dst = move _8, src = move _4, count = const 0_usize); // scope 3 at $DIR/lower_intrinsics.rs:+4:9: +4:95 | ||
+ goto -> bb1; // scope 3 at $DIR/lower_intrinsics.rs:+4:9: +4:95 | ||
} | ||
|
||
bb1: { | ||
StorageDead(_8); // scope 3 at $DIR/lower_intrinsics.rs:+4:94: +4:95 | ||
StorageDead(_4); // scope 3 at $DIR/lower_intrinsics.rs:+4:94: +4:95 | ||
StorageDead(_11); // scope 3 at $DIR/lower_intrinsics.rs:+4:95: +4:96 | ||
StorageDead(_10); // scope 3 at $DIR/lower_intrinsics.rs:+4:95: +4:96 | ||
StorageDead(_7); // scope 3 at $DIR/lower_intrinsics.rs:+4:95: +4:96 | ||
StorageDead(_6); // scope 3 at $DIR/lower_intrinsics.rs:+4:95: +4:96 | ||
StorageDead(_3); // scope 3 at $DIR/lower_intrinsics.rs:+4:95: +4:96 | ||
_0 = const (); // scope 3 at $DIR/lower_intrinsics.rs:+3:5: +5:6 | ||
StorageDead(_2); // scope 1 at $DIR/lower_intrinsics.rs:+6:1: +6:2 | ||
StorageDead(_1); // scope 0 at $DIR/lower_intrinsics.rs:+6:1: +6:2 | ||
return; // scope 0 at $DIR/lower_intrinsics.rs:+6:2: +6:2 | ||
} | ||
} | ||
|
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
146 changes: 0 additions & 146 deletions
146
src/test/mir-opt/separate_const_switch.identity.ConstProp.diff
This file was deleted.
Oops, something went wrong.
124 changes: 0 additions & 124 deletions
124
src/test/mir-opt/separate_const_switch.identity.PreCodegen.after.mir
This file was deleted.
Oops, something went wrong.
103 changes: 0 additions & 103 deletions
103
src/test/mir-opt/separate_const_switch.too_complex.ConstProp.diff
This file was deleted.
Oops, something went wrong.
73 changes: 0 additions & 73 deletions
73
src/test/mir-opt/separate_const_switch.too_complex.PreCodegen.after.mir
This file was deleted.
Oops, something went wrong.
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
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.