forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#123474 - jieyouxu:issue-7349-port, r=Mark-Simulacrum Port `run-make/issue-7349` to a codegen test The test does not need to be a run-make test, it can use the codegen test infrastructure. Also took the opportunity to rename the test to `no-redundant-item-monomorphization` so it's not just some opaque issue number. Part of rust-lang#121876.
- Loading branch information
Showing
4 changed files
with
33 additions
and
34 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// Test to make sure that inner functions within a polymorphic outer function | ||
// don't get re-codegened when the outer function is monomorphized. The test | ||
// code monomorphizes the outer functions several times, but the magic constants | ||
// used in the inner functions should each appear only once in the generated IR. | ||
|
||
// issue: rust-lang/rust#7349 | ||
//@ compile-flags: -Cno-prepopulate-passes -Copt-level=0 | ||
|
||
// CHECK-COUNT-1: ret i32 8675309 | ||
// CHECK-COUNT-1: ret i32 11235813 | ||
|
||
fn outer<T>() { | ||
#[allow(dead_code)] | ||
fn inner() -> u32 { | ||
8675309 | ||
} | ||
inner(); | ||
} | ||
|
||
extern "C" fn outer_foreign<T>() { | ||
#[allow(dead_code)] | ||
fn inner() -> u32 { | ||
11235813 | ||
} | ||
inner(); | ||
} | ||
|
||
fn main() { | ||
outer::<isize>(); | ||
outer::<usize>(); | ||
outer_foreign::<isize>(); | ||
outer_foreign::<usize>(); | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.