rust-lang/rust · #164108

Add unstable `-Zllvm-tpde` flag to `rustc_codegen_llvm`

TechnoPorg · merged Nov 13, 202633 files · 404 + / 15 −
compiler/rustc_codegen_llvm/src/back/llvm_backend.rs39 + / 2 −
@@ -22,12 +22,12 @@ use rustc_errors::{DiagCtxt, DiagCtxtHandle}; use rustc_metadata::EncodedMetadata; use rustc_middle::dep_graph::{WorkProduct, WorkProductMap}; use rustc_middle::ty::TyCtxt;-use rustc_session::config::{OutputFilenames, PrintKind, PrintRequest};+use rustc_session::config::{LtoCli, OptLevel, OutputFilenames, PrintKind, PrintRequest}; use rustc_session::{     BorrowedIncrCompSession, CodegenBackendInit, EarlySession, IncrCompSession, Session, }; use rustc_span::{Symbol, sym};-use rustc_target::spec::{RelocModel, TlsModel};+use rustc_target::spec::{RelocModel, SplitDebuginfo, TlsModel};  use crate::back::owned_target_machine::OwnedTargetMachine; use crate::back::write::{create_informational_target_machine, create_target_machine};@@ -209,6 +209,43 @@ impl CodegenBackend for LlvmCodegenBackend {             }         } +        // -Zllvm-tpde requires the TPDE pass plugin, which may not be available. If TPDE is used but not available,+        // we emit an early error here and abort compilation.+        {+            match llvm::TpdeWrapper::get_or_init(+                &sess.opts.sysroot,+                &sess.opts.unstable_opts.llvm_tpde,+            ) {+                Ok(_) => {}+                Err(llvm::TpdeLibraryError::NotFound { err }) => {+                    sess.dcx().emit_fatal(crate::diagnostics::TpdeComponentMissing { err });+                }+                Err(llvm::TpdeLibraryError::LoadFailed { err }) => {+                    sess.dcx().emit_fatal(crate::diagnostics::TpdeComponentUnavailable { err });+                }+            }++            if sess.opts.unstable_opts.llvm_tpde.is_some() {+                if !matches!(sess.opts.optimize, OptLevel::No | OptLevel::Less) {+                    sess.dcx().emit_warn(crate::diagnostics::TpdeHighOptLevel);+                }++                if sess.target.requires_lto+                    || !matches!(sess.early_lto(), LtoCli::No | LtoCli::Unspecified)+                {+                    sess.dcx().emit_fatal(crate::diagnostics::TpdeLtoUsed);+                }++                // JUSTIFICATION: the session doesn't exist at this point.+                #[allow(rustc::bad_opt_access)]+                if sess.opts.cg.split_debuginfo.unwrap_or(sess.target.split_debuginfo)+                    != SplitDebuginfo::Off+                {+                    sess.dcx().emit_fatal(crate::diagnostics::TpdeSplitDebugInfoUsed);+                }+            }+        }+         // Intrinsics whose fallback body will not be used by the LLVM backend.         let replaced_intrinsics = {             #[rustfmt::skip]
compiler/rustc_codegen_llvm/src/back/write.rs4 + / 1 −
@@ -38,7 +38,7 @@ use crate::diagnostics::{     UnsupportedCompression, WithLlvmError, WriteBytecode, }; use crate::llvm::diagnostic::OptimizationDiagnosticKind::*;-use crate::llvm::{self, DiagnosticInfo, TypeKind};+use crate::llvm::{self, DiagnosticInfo, TpdeWrapper, TypeKind}; use crate::type_::llvm_type_ptr; use crate::{LlvmCodegenBackend, ModuleLlvm, attributes, base, common, llvm_util}; @@ -69,6 +69,8 @@ fn write_output_file<'ll>(     } else {         std::ptr::null()     };++    let tpde = TpdeWrapper::get_instance();     let result = unsafe {         llvm::LLVMRustWriteOutputFile(             target,@@ -78,6 +80,7 @@ fn write_output_file<'ll>(             file_type,             verify_llvm_ir,             no_builtins,+            tpde.options().clone(),         )     }; 
compiler/rustc_codegen_llvm/src/diagnostics.rs27 + / 0 −
@@ -109,6 +109,33 @@ pub(crate) struct LtoBitcodeFromRlib {     pub err: String, } +#[derive(Diagnostic)]+#[diag("failed to load the TPDE backend: {$err}")]+pub(crate) struct TpdeComponentUnavailable {+    pub err: String,+}++#[derive(Diagnostic)]+#[diag("TPDE backend not found in the sysroot: {$err}")]+pub(crate) struct TpdeComponentMissing {+    pub err: String,+}++#[derive(Diagnostic)]+#[diag("using -Zllvm-tpde with optimization levels higher than 1 is not recommended")]+#[note(+    "compilation with TPDE at higher opt levels is more likely to fail, and to have worse runtime performance than LLVM even if it succeeds"+)]+pub(crate) struct TpdeHighOptLevel;++#[derive(Diagnostic)]+#[diag("using -Zllvm-tpde with LTO enabled is not supported")]+pub(crate) struct TpdeLtoUsed;++#[derive(Diagnostic)]+#[diag("using -Zllvm-tpde with split debuginfo is not supported")]+pub(crate) struct TpdeSplitDebugInfoUsed;+ #[derive(Diagnostic)] pub(crate) enum LlvmError<'a> {     #[diag("could not write output to {$path}")]
compiler/rustc_codegen_llvm/src/llvm/ffi.rs2 + / 2 −
@@ -28,8 +28,7 @@ use super::debuginfo::{     DIArray, DIBuilder, DIDerivedType, DIDescriptor, DIFile, DIFlags, DILocation, DISPFlags,     DIScope, DISubprogram, DITemplateTypeParameter, DIType, DebugEmissionKind, DebugNameTableKind, };-use crate::llvm;-use crate::llvm::MetadataKindId;+use crate::llvm::{self, LLVMRustTpdeOptions, MetadataKindId}; use crate::macros::TryFromU32;  mod branded;@@ -2488,6 +2487,7 @@ unsafe extern "C" {         FileType: FileType,         VerifyIR: bool,         DisableSimplifyLibCalls: bool,+        TpdeOptions: LLVMRustTpdeOptions,     ) -> LLVMRustResult;     pub(crate) fn LLVMRustOptimize<'ll>(         M: Module<'ll>,
compiler/rustc_codegen_llvm/src/llvm/mod.rs2 + / 0 −
@@ -20,9 +20,11 @@ pub(crate) mod enzyme_ffi; mod ffi; mod metadata_kind; pub(crate) mod offload_ffi;+pub(crate) mod tpde_ffi;  pub(crate) use self::enzyme_ffi::*; pub(crate) use self::offload_ffi::*;+pub(crate) use self::tpde_ffi::*;  impl LLVMRustResult {     pub(crate) fn into_result(self) -> Result<(), ()> {
compiler/rustc_codegen_llvm/src/llvm/tpde_ffi.rsadded125 + / 0 −
@@ -0,0 +1,125 @@+use std::path::PathBuf;+use std::sync::OnceLock;++use rustc_session::config::{self, Sysroot, host_tuple};+use rustc_session::filesearch;++unsafe extern "C" {+    type LLVMPassPluginLibraryInfo;+}++type LLVMGetPassPluginInfoFn = unsafe extern "C" fn() -> LLVMPassPluginLibraryInfo;++/// LLVMRustTpdeMode+#[repr(C)]+#[derive(Clone)]+pub(crate) enum LLVMRustTpdeMode {+    None,+    Only,+    Try,+}++/// LLVMRustTpdeOptions+#[repr(C)]+#[derive(Clone)]+pub(crate) struct LLVMRustTpdeOptions {+    mode: LLVMRustTpdeMode,+    // `None` if mode is `LLVMRustTpdeMode::None`+    plugin: Option<LLVMGetPassPluginInfoFn>,+}++pub(crate) struct TpdeWrapper {+    options: LLVMRustTpdeOptions,+    // Keep the dynamic library loaded while the function pointers are used.+    _lib: Option<libloading::Library>,+}++static TPDE_INSTANCE: OnceLock<TpdeWrapper> = OnceLock::new();++#[derive(Debug)]+pub(crate) enum TpdeLibraryError {+    NotFound { err: String },+    LoadFailed { err: String },+}++impl From<libloading::Error> for TpdeLibraryError {+    fn from(err: libloading::Error) -> Self {+        Self::LoadFailed { err: format!("{err:?}") }+    }+}++impl TpdeWrapper {+    /// Initialize TpdeWrapper with the given sysroot and mode if not already initialized.+    /// Safe to call multiple times - subsequent calls are no-ops due to OnceLock.+    pub(crate) fn get_or_init(+        sysroot: &rustc_session::config::Sysroot,+        mode: &Option<config::LlvmTpde>,+    ) -> Result<&'static Self, TpdeLibraryError> {+        let wrapper = TPDE_INSTANCE.get_or_try_init(|| {+            let w = match mode {+                Some(mode) => Self::call_dynamic(sysroot, mode)?,+                None => Self {+                    options: LLVMRustTpdeOptions { mode: LLVMRustTpdeMode::None, plugin: None },+                    _lib: None,+                },+            };+            Ok::<_, TpdeLibraryError>(w)+        })?;++        Ok(wrapper)+    }++    /// Get the TpdeWrapper instance. Panics if not initialized.+    pub(crate) fn get_instance() -> &'static Self {+        TPDE_INSTANCE+            .get()+            .expect("TpdeWrapper not initialized. Call get_or_init with sysroot first.")+    }++    pub(crate) fn options(&self) -> &LLVMRustTpdeOptions {+        &self.options+    }++    fn call_dynamic(+        sysroot: &rustc_session::config::Sysroot,+        mode: &config::LlvmTpde,+    ) -> Result<Self, TpdeLibraryError> {+        let mode = match mode {+            config::LlvmTpde::Only => LLVMRustTpdeMode::Only,+            config::LlvmTpde::Try => LLVMRustTpdeMode::Try,+        };+        let tpde_path = Self::get_tpde_path(sysroot)?;+        let lib = unsafe { libloading::Library::new(tpde_path)? };+        let llvm_get_pass_plugin_info =+            *unsafe { lib.get::<LLVMGetPassPluginInfoFn>(b"llvmGetPassPluginInfo\0")? };+        let options = LLVMRustTpdeOptions { mode, plugin: Some(llvm_get_pass_plugin_info) };+        Ok(Self { options, _lib: Some(lib) })+    }++    fn get_tpde_path(sysroot: &Sysroot) -> Result<PathBuf, TpdeLibraryError> {+        let path_buf = sysroot+            .all_paths()+            .map(|sysroot_path| {+                filesearch::make_target_lib_path(sysroot_path, host_tuple())+                    .join("lib")+                    .with_file_name("tpde-plugin")+                    .with_extension(std::env::consts::DLL_EXTENSION)+            })+            .find(|f| f.exists())+            .ok_or_else(|| {+                let candidates = sysroot+                    .all_paths()+                    .map(|p| p.join("lib").display().to_string())+                    .collect::<Vec<String>>()+                    .join("\n* ");+                TpdeLibraryError::NotFound {+                    err: format!(+                        "failed to find the `tpde-plugin` shared library \+                    in the sysroot candidates:\n* {candidates}"+                    ),+                }+            })?;++        Ok(path_buf)+    }+}
compiler/rustc_interface/src/tests.rs6 + / 4 −
@@ -14,10 +14,10 @@ use rustc_session::config::{     CoverageOptions, DebugInfo, DumpMonoStatsFormat, ErrorOutputType, ExternEntry, ExternLocation,     Externs, FmtDebug, FunctionReturn, IncrementalStateAssertion, InliningThreshold, Input,     InstrumentCoverage, InstrumentMcount, InstrumentMcountOpts, InstrumentXRay, LinkSelfContained,-    LinkerPluginLto, LocationDetail, LtoCli, MirIncludeSpans, NextSolverConfig, Offload, Options,-    OutFileName, OutputType, OutputTypes, PAuthKey, PacRet, Passes, PatchableFunctionEntry,-    Polonius, ProcMacroExecutionStrategy, Strip, SwitchWithOptPath, SymbolManglingVersion,-    WasiExecModel, build_session_options, rustc_optgroups,+    LinkerPluginLto, LlvmTpde, LocationDetail, LtoCli, MirIncludeSpans, NextSolverConfig, Offload,+    Options, OutFileName, OutputType, OutputTypes, PAuthKey, PacRet, Passes,+    PatchableFunctionEntry, Polonius, ProcMacroExecutionStrategy, Strip, SwitchWithOptPath,+    SymbolManglingVersion, WasiExecModel, build_session_options, rustc_optgroups, }; use rustc_session::search_paths::SearchPath; use rustc_session::utils::{CanonicalizedPath, NativeLib};@@ -846,6 +846,8 @@ fn test_unstable_options_tracking_hash() {     tracked!(lint_llvm_ir, true);     tracked!(llvm_module_flag, vec![("bar".to_string(), 123, "max".to_string())]);     tracked!(llvm_plugins, vec![String::from("plugin_name")]);+    tracked!(llvm_tpde, Some(LlvmTpde::Only));+    tracked!(llvm_tpde, Some(LlvmTpde::Try));     tracked!(llvm_writable, true);     tracked!(location_detail, LocationDetail { file: true, line: false, column: false });     tracked!(maximal_hir_to_mir_coverage, true);
compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp33 + / 5 −
@@ -479,11 +479,23 @@ static CodeGenFileType fromRust(LLVMRustFileType Type) {   } } -extern "C" LLVMRustResult-LLVMRustWriteOutputFile(LLVMTargetMachineRef Target, LLVMModuleRef M,-                        const char *Path, const char *DwoPath,-                        LLVMRustFileType RustFileType, bool VerifyIR,-                        bool DisableSimplifyLibCalls) {+extern "C" typedef llvm::PassPluginLibraryInfo (*LLVMGetPassPluginInfo)();++enum class LLVMRustTpdeMode {+  None,+  Only,+  Try,+};++struct LLVMRustTpdeOptions {+  LLVMRustTpdeMode mode;+  LLVMGetPassPluginInfo plugin;+};++extern "C" LLVMRustResult LLVMRustWriteOutputFile(+    LLVMTargetMachineRef Target, LLVMModuleRef M, const char *Path,+    const char *DwoPath, LLVMRustFileType RustFileType, bool VerifyIR,+    bool DisableSimplifyLibCalls, LLVMRustTpdeOptions TpdeOptions) {   auto FileType = fromRust(RustFileType);    std::string ErrorInfo;@@ -499,6 +511,22 @@ LLVMRustWriteOutputFile(LLVMTargetMachineRef Target, LLVMModuleRef M,   std::unique_ptr<llvm::raw_pwrite_stream> DwoOS = nullptr;   std::unique_ptr<llvm::raw_pwrite_stream> BDwoOS = nullptr;   auto BOS = buffer_ostream(OS);++  if (TpdeOptions.mode != LLVMRustTpdeMode::None) {+    assert(+        TpdeOptions.plugin &&+        "rustc_codegen_llvm must set TpdeOptions.plugin if using -Zllvm-tpde");+    llvm::PassPluginLibraryInfo plugin = TpdeOptions.plugin();+    if (plugin.PreCodeGenCallback(*unwrap(M), *unwrap(Target), FileType, BOS)) {+      return LLVMRustResult::Success;+    } else if (TpdeOptions.mode == LLVMRustTpdeMode::Only) {+      std::string error = "Failed to compile module " ++                          unwrap(M)->getModuleIdentifier() + " with TPDE";+      LLVMRustSetLastError(error.c_str());+      return LLVMRustResult::Failure;+    }+  }+   if (DwoPath) {     DwoOS = std::make_unique<raw_fd_ostream>(DwoPath, EC, sys::fs::OF_None);     if (EC) {
compiler/rustc_macros/src/diagnostics/message.rs1 + / 0 −
@@ -138,6 +138,7 @@ const ALLOWED_CAPITALIZED_WORDS: &[&str] = &[     "NaNs",     "OK",     "Rust",+    "TPDE",     "ThinLTO",     "Unicode",     "VS",
compiler/rustc_session/src/config.rs10 + / 1 −
@@ -3429,6 +3429,14 @@ impl PpMode {     } } +#[derive(Clone, Hash, PartialEq, Eq, Debug)]+pub enum LlvmTpde {+    /// Attempt to compile with TPDE-LLVM, but fall back to LLVM if unsupported LLVM IR is encountered+    Try,+    /// Attempt to compile with TPDE-LLVM, and bail if unsupported LLVM IR is encountered+    Only,+}+ #[derive(Clone, Hash, PartialEq, Eq, Debug)] pub enum WasiExecModel {     Command,@@ -3479,7 +3487,7 @@ pub(crate) mod dep_tracking {         AnnotateMoves, AutoDiff, BranchProtection, CFGuard, CFProtection, CodegenRetagOptions,         CoverageOptions, CrateType, DebugInfo, DebugInfoCompression, ErrorOutputType, FmtDebug,         FunctionReturn, InliningThreshold, InstrumentCoverage, InstrumentMcount,-        InstrumentMcountOpts, InstrumentXRay, LinkerPluginLto, LocationDetail, LtoCli,+        InstrumentMcountOpts, InstrumentXRay, LinkerPluginLto, LlvmTpde, LocationDetail, LtoCli,         MirStripDebugInfo, NextSolverConfig, Offload, OptLevel, OutFileName, OutputType,         OutputTypes, PatchableFunctionEntry, PointerAuthOption, Polonius, ResolveDocLinks,         SourceFileHashAlgorithm, SplitDwarfKind, SwitchWithOptPath, SymbolManglingVersion,@@ -3552,6 +3560,7 @@ pub(crate) mod dep_tracking {         InstrumentXRay,         LanguageIdentifier,         LinkerPluginLto,+        LlvmTpde,         LocationDetail,         LtoCli,         MergeFunctions,
compiler/rustc_session/src/options.rs11 + / 0 −
@@ -932,6 +932,7 @@ mod desc {     pub(crate) const parse_target_feature: &str = parse_string;     pub(crate) const parse_terminal_url: &str =         "either a boolean (`yes`, `no`, `on`, `off`, etc), or `auto`";+    pub(crate) const parse_llvm_tpde: &str = "either no value or one of: `try` (default), `only`";     pub(crate) const parse_wasi_exec_model: &str = "either `command` or `reactor`";     pub(crate) const parse_split_debuginfo: &str =         "one of supported split-debuginfo modes (`off`, `packed`, or `unpacked`)";@@ -1929,6 +1930,15 @@ pub mod parse {         true     } +    pub(crate) fn parse_llvm_tpde(slot: &mut Option<LlvmTpde>, v: Option<&str>) -> bool {+        *slot = match v {+            Some("try") | None => Some(LlvmTpde::Try),+            Some("only") => Some(LlvmTpde::Only),+            _ => return false,+        };+        true+    }+     pub(crate) fn parse_symbol_mangling_version(         slot: &mut Option<SymbolManglingVersion>,         v: Option<&str>,@@ -2982,6 +2992,7 @@ written to standard error output)"),     #[rustc_lint_opt_deny_field_access("use `Session::tls_model` instead of this field")]     tls_model: Option<TlsModel> = (None, parse_tls_model, [TRACKED],         "choose the TLS model to use (`rustc --print tls-models` for details)"),+    llvm_tpde: Option<LlvmTpde> = (None, parse_llvm_tpde, [TRACKED], "enable the experimental TPDE-LLVM codegen backend for debug builds"),     trace_macros: bool = (false, parse_bool, [UNTRACKED],         "for every macro invocation, print its name and arguments (default: no)"),     track_diagnostics: bool = (false, parse_bool, [UNTRACKED],
src/bootstrap/src/core/build_steps/test.rs4 + / 0 −
@@ -2625,6 +2625,10 @@ Please disable assertions with `rust.debug-assertions = false`.             cmd.arg("--has-offload");         } +        if builder.sess.config.llvm_tpde {+            cmd.arg("--has-tpde");+        }+         if builder.config.cmd.bless() {             cmd.arg("--bless");         }
src/doc/rustc-dev-guide/src/tests/directives.md1 + / 0 −
@@ -212,6 +212,7 @@ The following directives will check rustc build settings and target settings: - `needs-backends` — only runs the test if current codegen backend is listed. - `needs-offload` — ignores if our LLVM backend was not built with offload support. - `needs-enzyme` — ignores if our Enzyme submodule was not built.+- `needs-tpde` — ignores if the TPDE-LLVM codegen backend was not built  The following directives will check LLVM support: 
src/doc/unstable-book/src/compiler-flags/llvm-tpde.mdadded12 + / 0 −
@@ -0,0 +1,12 @@+# `llvm-tpde`++The tracking issue for this feature is: None.++---++The `-Zllvm-tpde[=VALUE]` compiler flag controls whether TPDE-LLVM is used as the codegen backend for debug builds instead of LLVM. If not set, LLVM is used.++Possible values are:++- `try` (default): attempt to compile with TPDE-LLVM, but fall back to LLVM if unsupported IR is encountered+- `only`: attempt to compile with TPDE-LLVM, and bail if unsupported IR is encountered
src/tools/compiletest/src/cli.rs3 + / 0 −
@@ -239,6 +239,8 @@ struct Args {     /// Run tests that require offload.     #[arg(long)]     has_offload: bool,+    #[arg(long)]+    has_tpde: bool,     /// Whether rustc was built with debug assertions.     #[arg(long)]     with_rustc_debug_assertions: bool,@@ -455,6 +457,7 @@ pub(crate) fn parse_config(args: Vec<String>) -> Config {          has_enzyme: args.has_enzyme,         has_offload: args.has_offload,+        has_tpde: args.has_tpde,         host: args.host,         host_compile_lib_path: make_absolute(args.compile_lib_path),         host_linker: args.host_linker,
src/tools/compiletest/src/common.rs3 + / 0 −
@@ -682,6 +682,9 @@ pub(crate) struct Config {     /// Whether to run `offload` autodiff tests.     pub(crate) has_offload: bool, +    /// Whether to run tests with the `tpde` LLVM backend+    pub(crate) has_tpde: bool,+     /// The current Rust channel info.     ///     /// FIXME: treat this more carefully; "stable", "beta" and "nightly" are definitely valid, but
src/tools/compiletest/src/directives/directive_names.rs1 + / 0 −
@@ -208,6 +208,7 @@ pub(crate) const KNOWN_DIRECTIVE_NAMES: &[&str] = &[     "needs-target-has-atomic",     "needs-target-std",     "needs-threads",+    "needs-tpde",     "needs-unwind",     "needs-wasmtime",     "needs-xray",
src/tools/compiletest/src/directives/needs.rs5 + / 0 −
@@ -239,6 +239,11 @@ pub(crate) fn prepare_needs_conditions(config: &Config) -> PreparedNeedsConditio             condition: config.has_offload && config.default_codegen_backend.is_llvm(),             ignore_reason: "ignored when LLVM Offload is disabled or LLVM is not the default codegen backend",         },+        Need {+            name: "needs-tpde",+            condition: config.has_tpde && config.default_codegen_backend.is_llvm(),+            ignore_reason: "ignored when TPDE-LLVM is disabled or LLVM is not the default codegen backend",+        },         Need {             name: "needs-run-enabled",             condition: config.run_enabled(),
src/tools/compiletest/src/rustdoc_gui_test.rs1 + / 0 −
@@ -119,6 +119,7 @@ fn incomplete_config_for_rustdoc_gui_test() -> Config {         rustfix_coverage: Default::default(),         has_enzyme: Default::default(),         has_offload: Default::default(),+        has_tpde: Default::default(),         channel: Default::default(),         git_hash: Default::default(),         cc: Default::default(),
tests/ui/README.md4 + / 0 −
@@ -1414,6 +1414,10 @@ Broad category for parallelism and multi-threaded tests, including attempting to  Exercises [tool attributes](https://doc.rust-lang.org/reference/attributes.html#tool-attributes). +## `tests/ui/tpde`++Exercises the experimental TPDE-LLVM codegen backend.+ ## `tests/ui/track-diagnostics/`  Exercises `#[track_caller]` and `-Z track-diagnostics`.
tests/ui/tpde/check_option.invalid.stderradded2 + / 0 −
@@ -0,0 +1,2 @@+error: incorrect value `invalid` for unstable option `llvm-tpde` - either no value or one of: `try` (default), `only` was expected+
tests/ui/tpde/check_option.rsadded16 + / 0 −
@@ -0,0 +1,16 @@+//@ revisions: implicit try only invalid+//@ needs-tpde+//+//@[implicit] build-pass+//@[try] build-pass+//@[only] build-pass+//@[invalid] check-fail+//+//@[implicit] compile-flags: -Zllvm-tpde+//@[try] compile-flags: -Zllvm-tpde=try+//@[only] compile-flags: -Zllvm-tpde=only+//@[invalid] compile-flags: -Zllvm-tpde=invalid++//[invalid]~? ERROR: incorrect value `invalid` for unstable option `llvm-tpde` - either no value or one of: `try` (default), `only` was expected++fn main() {}
tests/ui/tpde/llvm_fallback.only.stderradded4 + / 0 −
@@ -0,0 +1,4 @@+error: could not write output to $TEST_BUILD_DIR/llvm_fallback.llvm_fallback.bef9b9dab1dfd663-cgu.0.rcgu.o: Failed to compile module llvm_fallback.bef9b9dab1dfd663-cgu.0 with TPDE++error: aborting due to 1 previous error+
tests/ui/tpde/llvm_fallback.rsadded22 + / 0 −
@@ -0,0 +1,22 @@+//@ revisions: try only+//@ needs-tpde+//+//@[try] build-pass+//@[only] build-fail+//+//@[try] compile-flags: -Zllvm-tpde+//@[only] compile-flags: -Zllvm-tpde=only++//[only]~? ERROR: could not write output to $TEST_BUILD_DIR/llvm_fallback.llvm_fallback.bef9b9dab1dfd663-cgu.0.rcgu.o: Failed to compile module llvm_fallback.bef9b9dab1dfd663-cgu.0 with TPDE++// NOTE: if TPDE gains f16 support, this test will need to be adjusted++#![feature(f16)]++fn main() {+    if std::hint::black_box(0f16) == std::hint::black_box(7f16) {+        println!("same");+    } else {+        println!("different");+    }+}
tests/ui/tpde/no_lto.fat.stderradded2 + / 0 −
@@ -0,0 +1,2 @@+error: using -Zllvm-tpde with LTO enabled is not supported+
tests/ui/tpde/no_lto.rsadded16 + / 0 −
@@ -0,0 +1,16 @@+//@ revisions: no unspecified thin fat+//@ needs-tpde+//@ compile-flags: -Zllvm-tpde+//+//@[no] build-pass+//@[unspecified] build-pass+//@[thin] check-fail+//@[fat] check-fail+//+//@[no] compile-flags: -Clto=no+//@[thin] compile-flags: -Clto=thin+//@[fat] compile-flags: -Clto=fat++//[thin,fat]~? ERROR: using -Zllvm-tpde with LTO enabled is not supported++fn main() {}
tests/ui/tpde/no_lto.thin.stderradded2 + / 0 −
@@ -0,0 +1,2 @@+error: using -Zllvm-tpde with LTO enabled is not supported+
tests/ui/tpde/no_split_debuginfo.packed.stderradded2 + / 0 −
@@ -0,0 +1,2 @@+error: using -Zllvm-tpde with split debuginfo is not supported+
tests/ui/tpde/no_split_debuginfo.rsadded16 + / 0 −
@@ -0,0 +1,16 @@+//@ revisions: off unspecified packed unpacked+//@ needs-tpde+//@ compile-flags: -Zllvm-tpde+//+//@[off] build-pass+//@[unspecified] build-pass+//@[packed] check-fail+//@[unpacked] check-fail+//+//@[off] compile-flags: -Csplit-debuginfo=off+//@[packed] compile-flags: -Csplit-debuginfo=packed+//@[unpacked] compile-flags: -Csplit-debuginfo=unpacked++//[packed,unpacked]~? ERROR: using -Zllvm-tpde with split debuginfo is not supported++fn main() {}
tests/ui/tpde/no_split_debuginfo.unpacked.stderradded2 + / 0 −
@@ -0,0 +1,2 @@+error: using -Zllvm-tpde with split debuginfo is not supported+
tests/ui/tpde/opt_level.rsadded14 + / 0 −
@@ -0,0 +1,14 @@+//@ revisions: zero one two three+//@ needs-tpde+//@ build-pass+//@ compile-flags: -Zllvm-tpde+//+//@[zero] compile-flags: -Copt-level=0+//@[one] compile-flags: -Copt-level=1+//@[two] compile-flags: -Copt-level=2+//@[three] compile-flags: -Copt-level=3++//[two,three]~? WARN: using -Zllvm-tpde with optimization levels higher than 1 is not recommended+//[two,three]~? NOTE: compilation with TPDE at higher opt levels is more likely to fail, and to have worse runtime performance than LLVM even if it succeeds++fn main() {}
tests/ui/tpde/opt_level.three.stderradded6 + / 0 −
@@ -0,0 +1,6 @@+warning: using -Zllvm-tpde with optimization levels higher than 1 is not recommended+   |+   = note: compilation with TPDE at higher opt levels is more likely to fail, and to have worse runtime performance than LLVM even if it succeeds++warning: 1 warning emitted+
tests/ui/tpde/opt_level.two.stderradded6 + / 0 −
@@ -0,0 +1,6 @@+warning: using -Zllvm-tpde with optimization levels higher than 1 is not recommended+   |+   = note: compilation with TPDE at higher opt levels is more likely to fail, and to have worse runtime performance than LLVM even if it succeeds++warning: 1 warning emitted+