2024-06-25 05:39:19 -05:00
|
|
|
//@ only-linux
|
|
|
|
//@ ignore-cross-compile
|
|
|
|
|
|
|
|
use run_make_support::llvm::llvm_bin_dir;
|
2024-07-08 13:18:21 -05:00
|
|
|
use run_make_support::{
|
|
|
|
cmd, env_var, has_extension, llvm_filecheck, rustc, shallow_find_files, source_root,
|
|
|
|
};
|
2024-06-25 05:39:19 -05:00
|
|
|
|
|
|
|
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("-")
|
|
|
|
.arg("-Csave-temps")
|
|
|
|
.codegen_units(16)
|
|
|
|
.opt_level("2")
|
|
|
|
.target(&env_var("TARGET"))
|
2024-09-04 19:02:32 -05:00
|
|
|
.stdin_buf("fn main(){}")
|
2024-06-25 05:39:19 -05:00
|
|
|
.run();
|
|
|
|
|
|
|
|
// `llvm-dis` is used here since `--emit=llvm-ir` does not emit LLVM IR
|
|
|
|
// for temporary outputs.
|
2024-07-08 13:18:21 -05:00
|
|
|
let files = shallow_find_files(".", |path| has_extension(path, "bc"));
|
2024-07-05 04:19:52 -05:00
|
|
|
cmd(llvm_bin_dir().join("llvm-dis")).args(files).run();
|
2024-06-25 05:39:19 -05:00
|
|
|
|
|
|
|
// 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");
|
2024-07-08 13:18:21 -05:00
|
|
|
let files = shallow_find_files(".", |path| has_extension(path, "ll"));
|
|
|
|
for file in files {
|
|
|
|
llvm_filecheck().input_file(file).arg(&llvm_ident_path).run();
|
|
|
|
}
|
2024-06-25 05:39:19 -05:00
|
|
|
}
|