forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
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#126941 - GuillaumeGomez:migrate-run-make-ll…
…vm-ident, r=Kobzol Migrate `run-make/llvm-ident` to `rmake.rs` Part of rust-lang#121876. r? ``@Kobzol``
- Loading branch information
Showing
4 changed files
with
47 additions
and
20 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 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,40 @@ | ||
//@ only-linux | ||
|
||
use run_make_support::llvm::llvm_bin_dir; | ||
use run_make_support::{cmd, env_var, llvm_filecheck, read_dir, rustc, source_root}; | ||
|
||
use std::ffi::OsStr; | ||
|
||
fn main() { | ||
// `-Ccodegen-units=16 -Copt-level=2` is used here to trigger thin LTO | ||
// across codegen units to test deduplication of the named metadata | ||
// (see `LLVMRustPrepareThinLTOImport` for details). | ||
rustc() | ||
.emit("link,obj") | ||
.arg("-Csave-temps") | ||
.codegen_units(16) | ||
.opt_level("2") | ||
.target(&env_var("TARGET")) | ||
.arg("-") | ||
.stdin("fn main(){}") | ||
.run(); | ||
|
||
// `llvm-dis` is used here since `--emit=llvm-ir` does not emit LLVM IR | ||
// for temporary outputs. | ||
let mut files = Vec::new(); | ||
read_dir(".", |path| { | ||
if path.is_file() && path.extension().is_some_and(|ext| ext == OsStr::new("bc")) { | ||
files.push(path.to_path_buf()); | ||
} | ||
}); | ||
cmd(llvm_bin_dir().join("llvm-dis")).args(&files).run(); | ||
|
||
// Check LLVM IR files (including temporary outputs) have `!llvm.ident` | ||
// named metadata, reusing the related codegen test. | ||
let llvm_ident_path = source_root().join("tests/codegen/llvm-ident.rs"); | ||
read_dir(".", |path| { | ||
if path.is_file() && path.extension().is_some_and(|ext| ext == OsStr::new("ll")) { | ||
llvm_filecheck().input_file(path).arg(&llvm_ident_path).run(); | ||
} | ||
}); | ||
} |