-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rustc_mir: run the lower_intrinsics pass on MIR shims.
- Loading branch information
Showing
7 changed files
with
139 additions
and
2 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
24 changes: 24 additions & 0 deletions
24
src/test/mir-opt/lower_intrinsics.core.intrinsics-#1-discriminant_value.LowerIntrinsics.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,24 @@ | ||
- // MIR for `discriminant_value` before LowerIntrinsics | ||
+ // MIR for `discriminant_value` after LowerIntrinsics | ||
|
||
fn discriminant_value(_1: &T) -> <T as DiscriminantKind>::Discriminant { | ||
let mut _0: <T as std::marker::DiscriminantKind>::Discriminant; // return place in scope 0 at $SRC_DIR/core/src/intrinsics.rs:LL:COL | ||
|
||
bb0: { | ||
- _0 = discriminant_value::<T>(move _1) -> bb1; // scope 0 at $SRC_DIR/core/src/intrinsics.rs:LL:COL | ||
- // mir::Constant | ||
- // + span: $SRC_DIR/core/src/intrinsics.rs:LL:COL | ||
- // + literal: Const { ty: for<'r> extern "rust-intrinsic" fn(&'r T) -> <T as std::marker::DiscriminantKind>::Discriminant {std::intrinsics::discriminant_value::<T>}, val: Value(Scalar(<ZST>)) } | ||
+ _0 = discriminant((*_1)); // scope 0 at $SRC_DIR/core/src/intrinsics.rs:LL:COL | ||
+ goto -> bb1; // scope 0 at $SRC_DIR/core/src/intrinsics.rs:LL:COL | ||
} | ||
|
||
bb1: { | ||
return; // scope 0 at $SRC_DIR/core/src/intrinsics.rs:LL:COL | ||
} | ||
|
||
bb2 (cleanup): { | ||
resume; // scope 0 at $SRC_DIR/core/src/intrinsics.rs:LL:COL | ||
} | ||
} | ||
|
24 changes: 24 additions & 0 deletions
24
src/test/mir-opt/lower_intrinsics.core.intrinsics-#1-forget.LowerIntrinsics.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,24 @@ | ||
- // MIR for `std::intrinsics::forget` before LowerIntrinsics | ||
+ // MIR for `std::intrinsics::forget` after LowerIntrinsics | ||
|
||
fn std::intrinsics::forget(_1: T) -> () { | ||
let mut _0: (); // return place in scope 0 at $SRC_DIR/core/src/intrinsics.rs:LL:COL | ||
|
||
bb0: { | ||
- _0 = std::intrinsics::forget::<T>(move _1) -> bb1; // scope 0 at $SRC_DIR/core/src/intrinsics.rs:LL:COL | ||
- // mir::Constant | ||
- // + span: $SRC_DIR/core/src/intrinsics.rs:LL:COL | ||
- // + literal: Const { ty: extern "rust-intrinsic" fn(T) {std::intrinsics::forget::<T>}, val: Value(Scalar(<ZST>)) } | ||
+ _0 = const (); // scope 0 at $SRC_DIR/core/src/intrinsics.rs:LL:COL | ||
+ goto -> bb1; // scope 0 at $SRC_DIR/core/src/intrinsics.rs:LL:COL | ||
} | ||
|
||
bb1: { | ||
return; // scope 0 at $SRC_DIR/core/src/intrinsics.rs:LL:COL | ||
} | ||
|
||
bb2 (cleanup): { | ||
resume; // scope 0 at $SRC_DIR/core/src/intrinsics.rs:LL:COL | ||
} | ||
} | ||
|
24 changes: 24 additions & 0 deletions
24
src/test/mir-opt/lower_intrinsics.core.intrinsics-#1-size_of.LowerIntrinsics.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,24 @@ | ||
- // MIR for `std::intrinsics::size_of` before LowerIntrinsics | ||
+ // MIR for `std::intrinsics::size_of` after LowerIntrinsics | ||
|
||
fn std::intrinsics::size_of() -> usize { | ||
let mut _0: usize; // return place in scope 0 at $SRC_DIR/core/src/intrinsics.rs:LL:COL | ||
|
||
bb0: { | ||
- _0 = std::intrinsics::size_of::<T>() -> bb1; // scope 0 at $SRC_DIR/core/src/intrinsics.rs:LL:COL | ||
- // mir::Constant | ||
- // + span: $SRC_DIR/core/src/intrinsics.rs:LL:COL | ||
- // + literal: Const { ty: extern "rust-intrinsic" fn() -> usize {std::intrinsics::size_of::<T>}, val: Value(Scalar(<ZST>)) } | ||
+ _0 = SizeOf(T); // scope 0 at $SRC_DIR/core/src/intrinsics.rs:LL:COL | ||
+ goto -> bb1; // scope 0 at $SRC_DIR/core/src/intrinsics.rs:LL:COL | ||
} | ||
|
||
bb1: { | ||
return; // scope 0 at $SRC_DIR/core/src/intrinsics.rs:LL:COL | ||
} | ||
|
||
bb2 (cleanup): { | ||
resume; // scope 0 at $SRC_DIR/core/src/intrinsics.rs:LL:COL | ||
} | ||
} | ||
|
23 changes: 23 additions & 0 deletions
23
src/test/mir-opt/lower_intrinsics.core.intrinsics-#1-unreachable.LowerIntrinsics.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,23 @@ | ||
- // MIR for `std::intrinsics::unreachable` before LowerIntrinsics | ||
+ // MIR for `std::intrinsics::unreachable` after LowerIntrinsics | ||
|
||
fn std::intrinsics::unreachable() -> ! { | ||
let mut _0: !; // return place in scope 0 at $SRC_DIR/core/src/intrinsics.rs:LL:COL | ||
|
||
bb0: { | ||
- _0 = std::intrinsics::unreachable() -> bb1; // scope 0 at $SRC_DIR/core/src/intrinsics.rs:LL:COL | ||
- // mir::Constant | ||
- // + span: $SRC_DIR/core/src/intrinsics.rs:LL:COL | ||
- // + literal: Const { ty: unsafe extern "rust-intrinsic" fn() -> ! {std::intrinsics::unreachable}, val: Value(Scalar(<ZST>)) } | ||
+ unreachable; // scope 0 at $SRC_DIR/core/src/intrinsics.rs:LL:COL | ||
} | ||
|
||
bb1: { | ||
return; // scope 0 at $SRC_DIR/core/src/intrinsics.rs:LL:COL | ||
} | ||
|
||
bb2 (cleanup): { | ||
resume; // scope 0 at $SRC_DIR/core/src/intrinsics.rs:LL:COL | ||
} | ||
} | ||
|
24 changes: 24 additions & 0 deletions
24
src/test/mir-opt/lower_intrinsics.core.intrinsics-#1-wrapping_add.LowerIntrinsics.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,24 @@ | ||
- // MIR for `wrapping_add` before LowerIntrinsics | ||
+ // MIR for `wrapping_add` after LowerIntrinsics | ||
|
||
fn wrapping_add(_1: T, _2: T) -> T { | ||
let mut _0: T; // return place in scope 0 at $SRC_DIR/core/src/intrinsics.rs:LL:COL | ||
|
||
bb0: { | ||
- _0 = wrapping_add::<T>(move _1, move _2) -> bb1; // scope 0 at $SRC_DIR/core/src/intrinsics.rs:LL:COL | ||
- // mir::Constant | ||
- // + span: $SRC_DIR/core/src/intrinsics.rs:LL:COL | ||
- // + literal: Const { ty: extern "rust-intrinsic" fn(T, T) -> T {std::intrinsics::wrapping_add::<T>}, val: Value(Scalar(<ZST>)) } | ||
+ _0 = Add(move _1, move _2); // scope 0 at $SRC_DIR/core/src/intrinsics.rs:LL:COL | ||
+ goto -> bb1; // scope 0 at $SRC_DIR/core/src/intrinsics.rs:LL:COL | ||
} | ||
|
||
bb1: { | ||
return; // scope 0 at $SRC_DIR/core/src/intrinsics.rs:LL:COL | ||
} | ||
|
||
bb2 (cleanup): { | ||
resume; // scope 0 at $SRC_DIR/core/src/intrinsics.rs:LL:COL | ||
} | ||
} | ||
|
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