Skip to content

Conversation

hkratz
Copy link
Contributor

@hkratz hkratz commented Oct 8, 2021

With this change target specifications can opt in to provide a default setting for using the new LLVM pass manager via TargetOptions::new_llvm_pass_manager. In this PR it is only set to Some(false) for s390x, disabling the new pass manager due to some major performance problems with it (see #89609).

If no default is specified rustc_codegen_llvm::back::write::should_use_new_llvm_pass_manager() continues to enable the new pass manager iff the LLVM version is 13 or higher.

The command line option -Z new-llvm-pass-manager=(yes|no) continues to override default values and should_use_new_llvm_pass_manager() logic.

This is meant as a temporary measure until the problems with s390x are fixed.

@rust-highfive
Copy link
Contributor

r? @nagisa

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive
Copy link
Contributor

⚠️ Warning ⚠️

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 8, 2021
@rust-log-analyzer
Copy link
Collaborator

The job x86_64-gnu-llvm-10 failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
     Running unittests (build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps/rustc_target-4d2be095f77619ce)

running 181 tests
.................................................................................................... 100/181
...........................F........F............................................

---- spec::tests::s390x_unknown_linux_gnu stdout ----
---- spec::tests::s390x_unknown_linux_gnu stdout ----
thread 'spec::tests::s390x_unknown_linux_gnu' panicked at 'assertion failed: `(left == right)`
  left: `Ok(Target { llvm_target: "s390x-unknown-linux-gnu", pointer_width: 64, arch: "s390x", data_layout: "E-m:e-i1:8:16-i8:8:16-i64:64-f128:64-a:8:16-n32:64", options: TargetOptions { is_builtin: false, endian: big, c_int_width: "32", os: "linux", env: "gnu", abi: "", vendor: "unknown", linker_flavor: Gcc, linker: None, lld_flavor: Ld, pre_link_args: {}, pre_link_objects: {}, post_link_objects: {}, pre_link_objects_fallback: {}, post_link_objects_fallback: {}, crt_objects_fallback: None, late_link_args: {}, late_link_args_dynamic: {}, late_link_args_static: {}, post_link_args: {}, link_script: None, link_env: [], link_env_remove: [], asm_args: [], cpu: "z10", features: "-vector", dynamic_linking: true, only_cdylib: false, executables: true, relocation_model: Pic, code_model: None, tls_model: GeneralDynamic, disable_redzone: false, frame_pointer: MayOmit, function_sections: true, dll_prefix: "lib", dll_suffix: ".so", exe_suffix: "", staticlib_prefix: "lib", staticlib_suffix: ".a", families: ["unix"], abi_return_struct_as_int: false, is_like_osx: false, is_like_solaris: false, is_like_windows: false, is_like_msvc: false, is_like_emscripten: false, is_like_fuchsia: false, is_like_wasm: false, dwarf_version: None, linker_is_gnu: true, allows_weak_linkage: true, has_rpath: true, no_default_libraries: true, position_independent_executables: true, static_position_independent_executables: false, needs_plt: false, relro_level: Full, archive_format: "gnu", allow_asm: true, main_needs_argc_argv: true, has_elf_tls: true, obj_is_bitcode: false, forces_embed_bitcode: false, bitcode_llvm_cmdline: "", min_atomic_width: None, max_atomic_width: Some(64), atomic_cas: true, panic_strategy: Unwind, crt_static_allows_dylibs: false, crt_static_default: false, crt_static_respected: true, stack_probes: None, min_global_align: Some(16), default_codegen_units: None, trap_unreachable: true, requires_lto: false, singlethread: false, no_builtins: false, default_hidden_visibility: false, emit_debug_gdb_scripts: true, requires_uwtable: false, default_uwtable: false, simd_types_indirect: true, limit_rdylib_exports: true, override_export_symbols: None, merge_functions: Aliases, mcount: "mcount", llvm_abiname: "", relax_elf_relocations: false, llvm_args: [], use_ctors_section: false, eh_frame_header: true, has_thumb_interworking: false, split_debuginfo: Off, supported_sanitizers: (empty), default_adjusted_cabi: None, c_enum_min_bits: 32, llvm_new_pass_manager: None } })`,
 right: `Ok(Target { llvm_target: "s390x-unknown-linux-gnu", pointer_width: 64, arch: "s390x", data_layout: "E-m:e-i1:8:16-i8:8:16-i64:64-f128:64-a:8:16-n32:64", options: TargetOptions { is_builtin: false, endian: big, c_int_width: "32", os: "linux", env: "gnu", abi: "", vendor: "unknown", linker_flavor: Gcc, linker: None, lld_flavor: Ld, pre_link_args: {}, pre_link_objects: {}, post_link_objects: {}, pre_link_objects_fallback: {}, post_link_objects_fallback: {}, crt_objects_fallback: None, late_link_args: {}, late_link_args_dynamic: {}, late_link_args_static: {}, post_link_args: {}, link_script: None, link_env: [], link_env_remove: [], asm_args: [], cpu: "z10", features: "-vector", dynamic_linking: true, only_cdylib: false, executables: true, relocation_model: Pic, code_model: None, tls_model: GeneralDynamic, disable_redzone: false, frame_pointer: MayOmit, function_sections: true, dll_prefix: "lib", dll_suffix: ".so", exe_suffix: "", staticlib_prefix: "lib", staticlib_suffix: ".a", families: ["unix"], abi_return_struct_as_int: false, is_like_osx: false, is_like_solaris: false, is_like_windows: false, is_like_msvc: false, is_like_emscripten: false, is_like_fuchsia: false, is_like_wasm: false, dwarf_version: None, linker_is_gnu: true, allows_weak_linkage: true, has_rpath: true, no_default_libraries: true, position_independent_executables: true, static_position_independent_executables: false, needs_plt: false, relro_level: Full, archive_format: "gnu", allow_asm: true, main_needs_argc_argv: true, has_elf_tls: true, obj_is_bitcode: false, forces_embed_bitcode: false, bitcode_llvm_cmdline: "", min_atomic_width: None, max_atomic_width: Some(64), atomic_cas: true, panic_strategy: Unwind, crt_static_allows_dylibs: false, crt_static_default: false, crt_static_respected: true, stack_probes: None, min_global_align: Some(16), default_codegen_units: None, trap_unreachable: true, requires_lto: false, singlethread: false, no_builtins: false, default_hidden_visibility: false, emit_debug_gdb_scripts: true, requires_uwtable: false, default_uwtable: false, simd_types_indirect: true, limit_rdylib_exports: true, override_export_symbols: None, merge_functions: Aliases, mcount: "mcount", llvm_abiname: "", relax_elf_relocations: false, llvm_args: [], use_ctors_section: false, eh_frame_header: true, has_thumb_interworking: false, split_debuginfo: Off, supported_sanitizers: (empty), default_adjusted_cabi: None, c_enum_min_bits: 32, llvm_new_pass_manager: Some(false) } })`', compiler/rustc_target/src/spec/tests/tests_impl.rs:6:5

---- spec::tests::s390x_unknown_linux_musl stdout ----
thread 'spec::tests::s390x_unknown_linux_musl' panicked at 'assertion failed: `(left == right)`
thread 'spec::tests::s390x_unknown_linux_musl' panicked at 'assertion failed: `(left == right)`
  left: `Ok(Target { llvm_target: "s390x-unknown-linux-musl", pointer_width: 64, arch: "s390x", data_layout: "E-m:e-i1:8:16-i8:8:16-i64:64-f128:64-a:8:16-n32:64", options: TargetOptions { is_builtin: false, endian: big, c_int_width: "32", os: "linux", env: "musl", abi: "", vendor: "unknown", linker_flavor: Gcc, linker: None, lld_flavor: Ld, pre_link_args: {}, pre_link_objects: {}, post_link_objects: {}, pre_link_objects_fallback: {DynamicNoPicExe: ["crt1.o", "crti.o", "crtbegin.o"], DynamicPicExe: ["Scrt1.o", "crti.o", "crtbeginS.o"], StaticNoPicExe: ["crt1.o", "crti.o", "crtbegin.o"], StaticPicExe: ["rcrt1.o", "crti.o", "crtbeginS.o"], DynamicDylib: ["crti.o", "crtbeginS.o"], StaticDylib: ["crti.o", "crtbeginS.o"]}, post_link_objects_fallback: {DynamicNoPicExe: ["crtend.o", "crtn.o"], DynamicPicExe: ["crtendS.o", "crtn.o"], StaticNoPicExe: ["crtend.o", "crtn.o"], StaticPicExe: ["crtendS.o", "crtn.o"], DynamicDylib: ["crtendS.o", "crtn.o"], StaticDylib: ["crtendS.o", "crtn.o"]}, crt_objects_fallback: Some(Musl), late_link_args: {}, late_link_args_dynamic: {}, late_link_args_static: {}, post_link_args: {}, link_script: None, link_env: [], link_env_remove: [], asm_args: [], cpu: "z10", features: "-vector", dynamic_linking: true, only_cdylib: false, executables: true, relocation_model: Pic, code_model: None, tls_model: GeneralDynamic, disable_redzone: false, frame_pointer: MayOmit, function_sections: true, dll_prefix: "lib", dll_suffix: ".so", exe_suffix: "", staticlib_prefix: "lib", staticlib_suffix: ".a", families: ["unix"], abi_return_struct_as_int: false, is_like_osx: false, is_like_solaris: false, is_like_windows: false, is_like_msvc: false, is_like_emscripten: false, is_like_fuchsia: false, is_like_wasm: false, dwarf_version: None, linker_is_gnu: true, allows_weak_linkage: true, has_rpath: true, no_default_libraries: true, position_independent_executables: true, static_position_independent_executables: true, needs_plt: false, relro_level: Full, archive_format: "gnu", allow_asm: true, main_needs_argc_argv: true, has_elf_tls: true, obj_is_bitcode: false, forces_embed_bitcode: false, bitcode_llvm_cmdline: "", min_atomic_width: None, max_atomic_width: Some(64), atomic_cas: true, panic_strategy: Unwind, crt_static_allows_dylibs: false, crt_static_default: true, crt_static_respected: true, stack_probes: None, min_global_align: Some(16), default_codegen_units: None, trap_unreachable: true, requires_lto: false, singlethread: false, no_builtins: false, default_hidden_visibility: false, emit_debug_gdb_scripts: true, requires_uwtable: false, default_uwtable: false, simd_types_indirect: true, limit_rdylib_exports: true, override_export_symbols: None, merge_functions: Aliases, mcount: "mcount", llvm_abiname: "", relax_elf_relocations: false, llvm_args: [], use_ctors_section: false, eh_frame_header: true, has_thumb_interworking: false, split_debuginfo: Off, supported_sanitizers: (empty), default_adjusted_cabi: None, c_enum_min_bits: 32, llvm_new_pass_manager: None } })`,
 right: `Ok(Target { llvm_target: "s390x-unknown-linux-musl", pointer_width: 64, arch: "s390x", data_layout: "E-m:e-i1:8:16-i8:8:16-i64:64-f128:64-a:8:16-n32:64", options: TargetOptions { is_builtin: false, endian: big, c_int_width: "32", os: "linux", env: "musl", abi: "", vendor: "unknown", linker_flavor: Gcc, linker: None, lld_flavor: Ld, pre_link_args: {}, pre_link_objects: {}, post_link_objects: {}, pre_link_objects_fallback: {DynamicNoPicExe: ["crt1.o", "crti.o", "crtbegin.o"], DynamicPicExe: ["Scrt1.o", "crti.o", "crtbeginS.o"], StaticNoPicExe: ["crt1.o", "crti.o", "crtbegin.o"], StaticPicExe: ["rcrt1.o", "crti.o", "crtbeginS.o"], DynamicDylib: ["crti.o", "crtbeginS.o"], StaticDylib: ["crti.o", "crtbeginS.o"]}, post_link_objects_fallback: {DynamicNoPicExe: ["crtend.o", "crtn.o"], DynamicPicExe: ["crtendS.o", "crtn.o"], StaticNoPicExe: ["crtend.o", "crtn.o"], StaticPicExe: ["crtendS.o", "crtn.o"], DynamicDylib: ["crtendS.o", "crtn.o"], StaticDylib: ["crtendS.o", "crtn.o"]}, crt_objects_fallback: Some(Musl), late_link_args: {}, late_link_args_dynamic: {}, late_link_args_static: {}, post_link_args: {}, link_script: None, link_env: [], link_env_remove: [], asm_args: [], cpu: "z10", features: "-vector", dynamic_linking: true, only_cdylib: false, executables: true, relocation_model: Pic, code_model: None, tls_model: GeneralDynamic, disable_redzone: false, frame_pointer: MayOmit, function_sections: true, dll_prefix: "lib", dll_suffix: ".so", exe_suffix: "", staticlib_prefix: "lib", staticlib_suffix: ".a", families: ["unix"], abi_return_struct_as_int: false, is_like_osx: false, is_like_solaris: false, is_like_windows: false, is_like_msvc: false, is_like_emscripten: false, is_like_fuchsia: false, is_like_wasm: false, dwarf_version: None, linker_is_gnu: true, allows_weak_linkage: true, has_rpath: true, no_default_libraries: true, position_independent_executables: true, static_position_independent_executables: true, needs_plt: false, relro_level: Full, archive_format: "gnu", allow_asm: true, main_needs_argc_argv: true, has_elf_tls: true, obj_is_bitcode: false, forces_embed_bitcode: false, bitcode_llvm_cmdline: "", min_atomic_width: None, max_atomic_width: Some(64), atomic_cas: true, panic_strategy: Unwind, crt_static_allows_dylibs: false, crt_static_default: true, crt_static_respected: true, stack_probes: None, min_global_align: Some(16), default_codegen_units: None, trap_unreachable: true, requires_lto: false, singlethread: false, no_builtins: false, default_hidden_visibility: false, emit_debug_gdb_scripts: true, requires_uwtable: false, default_uwtable: false, simd_types_indirect: true, limit_rdylib_exports: true, override_export_symbols: None, merge_functions: Aliases, mcount: "mcount", llvm_abiname: "", relax_elf_relocations: false, llvm_args: [], use_ctors_section: false, eh_frame_header: true, has_thumb_interworking: false, split_debuginfo: Off, supported_sanitizers: (empty), default_adjusted_cabi: None, c_enum_min_bits: 32, llvm_new_pass_manager: Some(false) } })`', compiler/rustc_target/src/spec/tests/tests_impl.rs:6:5

failures:
    spec::tests::s390x_unknown_linux_gnu
    spec::tests::s390x_unknown_linux_gnu
error: test failed, to rerun pass '-p rustc_target --lib'

test result: FAILED. 179 passed; 2 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.01s




command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "test" "--target" "x86_64-unknown-linux-gnu" "-Zbinary-dep-depinfo" "-j" "16" "--release" "--locked" "--color" "always" "--features" " llvm" "--manifest-path" "/checkout/compiler/rustc/Cargo.toml" "-p" "rustc_target" "--" "--quiet"


Build completed unsuccessfully in 0:26:44

@hkratz hkratz marked this pull request as draft October 8, 2021 09:47
@hkratz
Copy link
Contributor Author

hkratz commented Oct 8, 2021

Closing in favor of #89666. I did not realize that adding a field to the target spec would make it public contract. As this is only meant as a stop-gap measure exposing that is not a good idea.

@hkratz hkratz closed this Oct 8, 2021
@nagisa
Copy link
Member

nagisa commented Oct 8, 2021

The target specification schema isn't considered a stable interface, but this seems like a bug that we'd like to fix either way so having an option to change this through a target seems unnecessary.

@hkratz hkratz deleted the disable_new_llvm_pass_manager_on_s390x branch November 27, 2021 05:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants