-
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.
Add -Zcross-crate-inline-threshold=yes
- Loading branch information
Showing
10 changed files
with
161 additions
and
13 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
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,13 @@ | ||
// compile-flags: -O | ||
// aux-build:always.rs | ||
|
||
#![crate_type = "lib"] | ||
|
||
extern crate always; | ||
|
||
// Check that we inline a cross-crate call, even though it isn't a leaf | ||
#[no_mangle] | ||
pub fn outer() -> String { | ||
// CHECK-NOT: call {{.*}}stem_fn | ||
always::stem_fn() | ||
} |
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,20 @@ | ||
// compile-flags: -O -Zcross-crate-inline-threshold=always | ||
|
||
#![crate_type = "lib"] | ||
|
||
// This function *looks* like it contains a call, but that call will be optimized out by MIR | ||
// optimizations. | ||
pub fn leaf_fn() -> String { | ||
String::new() | ||
} | ||
|
||
// This function contains a call, even after MIR optimizations. It is only eligible for | ||
// cross-crate-inlining with "always". | ||
pub fn stem_fn() -> String { | ||
inner() | ||
} | ||
|
||
#[inline(never)] | ||
fn inner() -> String { | ||
String::from("test") | ||
} |
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,20 @@ | ||
// compile-flags: -O | ||
|
||
#![crate_type = "lib"] | ||
|
||
// This function *looks* like it contains a call, but that call will be optimized out by MIR | ||
// optimizations. | ||
pub fn leaf_fn() -> String { | ||
String::new() | ||
} | ||
|
||
// This function contains a call, even after MIR optimizations. It is only eligible for | ||
// cross-crate-inlining with "always". | ||
pub fn stem_fn() -> String { | ||
inner() | ||
} | ||
|
||
#[inline(never)] | ||
fn inner() -> String { | ||
String::from("test") | ||
} |
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,20 @@ | ||
// compile-flags: -O -Zcross-crate-inline-threshold=never | ||
|
||
#![crate_type = "lib"] | ||
|
||
// This function *looks* like it contains a call, but that call will be optimized out by MIR | ||
// optimizations. | ||
pub fn leaf_fn() -> String { | ||
String::new() | ||
} | ||
|
||
// This function contains a call, even after MIR optimizations. It is only eligible for | ||
// cross-crate-inlining with "always". | ||
pub fn stem_fn() -> String { | ||
inner() | ||
} | ||
|
||
#[inline(never)] | ||
fn inner() -> String { | ||
String::from("test") | ||
} |
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,20 @@ | ||
// compile-flags: -O -Zcross-crate-inline-threshold=yes | ||
// aux-build:leaf.rs | ||
|
||
#![crate_type = "lib"] | ||
|
||
extern crate leaf; | ||
|
||
// Check that we inline a leaf cross-crate call | ||
#[no_mangle] | ||
pub fn leaf_outer() -> String { | ||
// CHECK-NOT: call {{.*}}leaf_fn | ||
leaf::leaf_fn() | ||
} | ||
|
||
// Check that we do not inline a non-leaf cross-crate call | ||
#[no_mangle] | ||
pub fn stem_outer() -> String { | ||
// CHECK: call {{.*}}stem_fn | ||
leaf::stem_fn() | ||
} |
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,13 @@ | ||
// compile-flags: -O | ||
// aux-build:never.rs | ||
|
||
#![crate_type = "lib"] | ||
|
||
extern crate never; | ||
|
||
// Check that we do not inline a cross-crate call, even though it is a leaf | ||
#[no_mangle] | ||
pub fn outer() -> String { | ||
// CHECK: call {{.*}}leaf_fn | ||
never::leaf_fn() | ||
} |