Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port run-make/issue-7349 to a codegen test #123474

Merged
merged 1 commit into from
Apr 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/tools/tidy/src/allowed_run_make_makefiles.txt
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ run-make/issue-53964/Makefile
run-make/issue-64153/Makefile
run-make/issue-68794-textrel-on-minimal-lib/Makefile
run-make/issue-69368/Makefile
run-make/issue-7349/Makefile
run-make/issue-83045/Makefile
run-make/issue-83112-incr-test-moved-file/Makefile
run-make/issue-84395-lto-embed-bitcode/Makefile
Expand Down
33 changes: 33 additions & 0 deletions tests/codegen/no-redundant-item-monomorphization.rs
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>();
}
11 changes: 0 additions & 11 deletions tests/run-make/issue-7349/Makefile

This file was deleted.

22 changes: 0 additions & 22 deletions tests/run-make/issue-7349/foo.rs

This file was deleted.

Loading