Skip to content

Commit 0d5ee65

Browse files
Rollup merge of #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 #121876.
2 parents 02ee8a8 + 476156a commit 0d5ee65

File tree

4 files changed

+33
-34
lines changed

4 files changed

+33
-34
lines changed

src/tools/tidy/src/allowed_run_make_makefiles.txt

-1
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,6 @@ run-make/issue-53964/Makefile
130130
run-make/issue-64153/Makefile
131131
run-make/issue-68794-textrel-on-minimal-lib/Makefile
132132
run-make/issue-69368/Makefile
133-
run-make/issue-7349/Makefile
134133
run-make/issue-83045/Makefile
135134
run-make/issue-83112-incr-test-moved-file/Makefile
136135
run-make/issue-84395-lto-embed-bitcode/Makefile
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// Test to make sure that inner functions within a polymorphic outer function
2+
// don't get re-codegened when the outer function is monomorphized. The test
3+
// code monomorphizes the outer functions several times, but the magic constants
4+
// used in the inner functions should each appear only once in the generated IR.
5+
6+
// issue: rust-lang/rust#7349
7+
//@ compile-flags: -Cno-prepopulate-passes -Copt-level=0
8+
9+
// CHECK-COUNT-1: ret i32 8675309
10+
// CHECK-COUNT-1: ret i32 11235813
11+
12+
fn outer<T>() {
13+
#[allow(dead_code)]
14+
fn inner() -> u32 {
15+
8675309
16+
}
17+
inner();
18+
}
19+
20+
extern "C" fn outer_foreign<T>() {
21+
#[allow(dead_code)]
22+
fn inner() -> u32 {
23+
11235813
24+
}
25+
inner();
26+
}
27+
28+
fn main() {
29+
outer::<isize>();
30+
outer::<usize>();
31+
outer_foreign::<isize>();
32+
outer_foreign::<usize>();
33+
}

tests/run-make/issue-7349/Makefile

-11
This file was deleted.

tests/run-make/issue-7349/foo.rs

-22
This file was deleted.

0 commit comments

Comments
 (0)