forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 7
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#126427 - Oneirical:oktobertest, r=jieyouxu Rewrite `intrinsic-unreachable`, `sepcomp-cci-copies`, `sepcomp-inlining` and `sepcomp-separate` `run-make` tests to rmake.rs Part of rust-lang#121876 and the associated [Google Summer of Code project](https://blog.rust-lang.org/2024/05/01/gsoc-2024-selected-projects.html).
- Loading branch information
Showing
11 changed files
with
99 additions
and
62 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 was deleted.
Oops, something went wrong.
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 @@ | ||
// intrinsics::unreachable tells the compiler that a certain point in the code | ||
// is not reachable by any means, which enables some useful optimizations. | ||
// In this test, exit-unreachable contains this instruction and exit-ret does not, | ||
// which means the emitted artifacts should be shorter in length. | ||
// See https://github.com/rust-lang/rust/pull/16970 | ||
|
||
//@ needs-asm-support | ||
//@ ignore-windows | ||
// Reason: Because of Windows exception handling, the code is not necessarily any shorter. | ||
|
||
use run_make_support::{fs_wrapper, rustc}; | ||
|
||
fn main() { | ||
rustc().opt().emit("asm").input("exit-ret.rs").run(); | ||
rustc().opt().emit("asm").input("exit-unreachable.rs").run(); | ||
assert!( | ||
fs_wrapper::read_to_string("exit-unreachable.s").lines().count() | ||
< fs_wrapper::read_to_string("exit-ret.s").lines().count() | ||
); | ||
} |
This file was deleted.
Oops, something went wrong.
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,17 @@ | ||
// Check that cross-crate inlined items are inlined in all compilation units | ||
// that refer to them, and not in any other compilation units. | ||
// Note that we have to pass `-C codegen-units=6` because up to two CGUs may be | ||
// created for each source module (see `rustc_const_eval::monomorphize::partitioning`). | ||
// See https://github.com/rust-lang/rust/pull/16367 | ||
|
||
use run_make_support::{ | ||
count_regex_matches_in_files_with_extension, cwd, fs_wrapper, has_extension, regex, rustc, | ||
shallow_find_files, | ||
}; | ||
|
||
fn main() { | ||
rustc().input("cci_lib.rs").run(); | ||
rustc().input("foo.rs").emit("llvm-ir").codegen_units(6).arg("-Zinline-in-all-cgus").run(); | ||
let re = regex::Regex::new(r#"define\ .*cci_fn"#).unwrap(); | ||
assert_eq!(count_regex_matches_in_files_with_extension(&re, "ll"), 2); | ||
} |
This file was deleted.
Oops, something went wrong.
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,23 @@ | ||
// Test that #[inline] functions still get inlined across compilation unit | ||
// boundaries. Compilation should produce three IR files, but only the two | ||
// compilation units that have a usage of the #[inline] function should | ||
// contain a definition. Also, the non-#[inline] function should be defined | ||
// in only one compilation unit. | ||
// See https://github.com/rust-lang/rust/pull/16367 | ||
|
||
use run_make_support::{ | ||
count_regex_matches_in_files_with_extension, cwd, fs_wrapper, has_extension, regex, rustc, | ||
shallow_find_files, | ||
}; | ||
|
||
fn main() { | ||
rustc().input("foo.rs").emit("llvm-ir").codegen_units(3).arg("-Zinline-in-all-cgus").run(); | ||
let re = regex::Regex::new(r#"define\ i32\ .*inlined"#).unwrap(); | ||
assert_eq!(count_regex_matches_in_files_with_extension(&re, "ll"), 0); | ||
let re = regex::Regex::new(r#"define\ internal\ .*inlined"#).unwrap(); | ||
assert_eq!(count_regex_matches_in_files_with_extension(&re, "ll"), 2); | ||
let re = regex::Regex::new(r#"define\ hidden\ i32\ .*normal"#).unwrap(); | ||
assert_eq!(count_regex_matches_in_files_with_extension(&re, "ll"), 1); | ||
let re = regex::Regex::new(r#"declare\ hidden\ i32\ .*normal"#).unwrap(); | ||
assert_eq!(count_regex_matches_in_files_with_extension(&re, "ll"), 2); | ||
} |
This file was deleted.
Oops, something went wrong.
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,15 @@ | ||
// Test that separate compilation actually puts code into separate compilation | ||
// units. `foo.rs` defines `magic_fn` in three different modules, which should | ||
// wind up in three different compilation units. | ||
// See https://github.com/rust-lang/rust/pull/16367 | ||
|
||
use run_make_support::{ | ||
count_regex_matches_in_files_with_extension, cwd, fs_wrapper, has_extension, regex, rustc, | ||
shallow_find_files, | ||
}; | ||
|
||
fn main() { | ||
rustc().input("foo.rs").emit("llvm-ir").codegen_units(3).run(); | ||
let re = regex::Regex::new(r#"define\ .*magic_fn"#).unwrap(); | ||
assert_eq!(count_regex_matches_in_files_with_extension(&re, "ll"), 3); | ||
} |