-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #68213 - wesleywiser:try_turning_on_inliner, r=<try>
[do not merge] Try turning on MIR inliner by default Try turning on the MIR inliner by default to measure the performance impact. Rebased on top of #68170 to get that fix. r? @ghost
- Loading branch information
Showing
7 changed files
with
83 additions
and
23 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// compile-flags: -Z mir-opt-level=2 | ||
// run-pass | ||
|
||
struct Baz<T: ?Sized> { | ||
a: T | ||
} | ||
|
||
fn main() { | ||
let d : Baz<[i32; 4]> = Baz { a: [1,2,3,4] }; | ||
assert_eq!([1, 2, 3, 4], d.a); | ||
} |
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 @@ | ||
// compile-flags: -Z mir-opt-level=3 | ||
// run-pass | ||
|
||
struct X { | ||
x: isize | ||
} | ||
|
||
fn f1(a: &mut X, b: &mut isize, c: isize) -> isize { | ||
let r = a.x + *b + c; | ||
a.x = 0; | ||
*b = 10; | ||
return r; | ||
} | ||
|
||
fn f2<F>(a: isize, f: F) -> isize where F: FnOnce(isize) { f(1); return a; } | ||
|
||
pub fn main() { | ||
let mut a = X {x: 1}; | ||
let mut b = 2; | ||
let c = 3; | ||
assert_eq!(f1(&mut a, &mut b, c), 6); | ||
assert_eq!(a.x, 0); | ||
assert_eq!(f2(a.x, |_| a.x = 50), 0); | ||
} |
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 @@ | ||
// compile-flags: -Z mir-opt-level=2 | ||
// run-pass | ||
|
||
use std::cell::Cell; | ||
|
||
#[derive(Debug)] | ||
struct B<'a> { | ||
a: [Cell<Option<&'a B<'a>>>; 2] | ||
} | ||
|
||
impl<'a> B<'a> { | ||
fn new() -> B<'a> { | ||
B { a: [Cell::new(None), Cell::new(None)] } | ||
} | ||
} | ||
|
||
fn f() { | ||
let b2 = B::new(); | ||
b2.a[0].set(Some(&b2)); | ||
} | ||
|
||
fn main() { | ||
f(); | ||
} |
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,18 @@ | ||
// compile-flags: -Z mir-opt-level=2 | ||
// run-pass | ||
|
||
fn e220() -> (i64, i64) { | ||
#[inline(never)] | ||
fn get_displacement() -> [i64; 2] { | ||
[139776, 963904] | ||
} | ||
|
||
let res = get_displacement(); | ||
match (&res[0], &res[1]) { | ||
(arg0, arg1) => (*arg0, *arg1), | ||
} | ||
} | ||
|
||
fn main() { | ||
assert_eq!(e220(), (139776, 963904)); | ||
} |