Auto merge of #87570 - nikic:llvm-13, r=nagisa
Upgrade to LLVM 13 Work in progress update to LLVM 13. Main changes: * InlineAsm diagnostics reported using SrcMgr diagnostic kind are now handled. Previously these used a separate diag handler. * Codegen tests are updated for additional attributes. * Some data layouts have changed. * Switch `#[used]` attribute from `llvm.used` to `llvm.compiler.used` to avoid SHF_GNU_RETAIN flag introduced in https://reviews.llvm.org/D97448, which appears to trigger a bug in older versions of gold. * Set `LLVM_INCLUDE_TESTS=OFF` to avoid Python 3.6 requirement. Upstream issues: * ~~https://bugs.llvm.org/show_bug.cgi?id=51210 (InlineAsm diagnostic reporting for module asm)~~ Fixed by1558bb80c0
. * ~~https://bugs.llvm.org/show_bug.cgi?id=51476 (Miscompile on AArch64 due to incorrect comparison elimination)~~ Fixed by81b106584f
. * https://bugs.llvm.org/show_bug.cgi?id=51207 (Can't set custom section flags anymore). Problematic change reverted in our fork, https://reviews.llvm.org/D107216 posted for upstream revert. * https://bugs.llvm.org/show_bug.cgi?id=51211 (Regression in codegen for #83623). This is an optimization regression that we may likely have to eat for this release. The fix for #83623 was based on an incorrect premise, and this needs to be properly addressed in the MergeICmps pass. The [compile-time impact](https://perf.rust-lang.org/compare.html?start=ef9549b6c0efb7525c9b012148689c8d070f9bc0&end=0983094463497eec22d550dad25576a894687002) is mixed, but quite positive as LLVM upgrades go. The LLVM 13 final release is scheduled for Sep 21st. The current nightly is scheduled for stable release on Oct 21st. r? `@ghost`
This commit is contained in:
commit
db002a06ae
30 changed files with 202 additions and 169 deletions
|
@ -16,9 +16,11 @@ pub trait MiscMethods<'tcx>: BackendTypes {
|
|||
fn sess(&self) -> &Session;
|
||||
fn codegen_unit(&self) -> &'tcx CodegenUnit<'tcx>;
|
||||
fn used_statics(&self) -> &RefCell<Vec<Self::Value>>;
|
||||
fn compiler_used_statics(&self) -> &RefCell<Vec<Self::Value>>;
|
||||
fn set_frame_pointer_type(&self, llfn: Self::Function);
|
||||
fn apply_target_cpu_attr(&self, llfn: Self::Function);
|
||||
fn create_used_variable(&self);
|
||||
fn create_compiler_used_variable(&self);
|
||||
/// Declares the extern "C" main function for the entry point. Returns None if the symbol already exists.
|
||||
fn declare_c_main(&self, fn_type: Self::Type) -> Option<Self::Function>;
|
||||
}
|
||||
|
|
|
@ -6,17 +6,15 @@ pub trait StaticMethods: BackendTypes {
|
|||
fn static_addr_of(&self, cv: Self::Value, align: Align, kind: Option<&str>) -> Self::Value;
|
||||
fn codegen_static(&self, def_id: DefId, is_mutable: bool);
|
||||
|
||||
/// Mark the given global value as "used", to prevent a backend from potentially removing a
|
||||
/// static variable that may otherwise appear unused.
|
||||
///
|
||||
/// Static variables in Rust can be annotated with the `#[used]` attribute to direct the `rustc`
|
||||
/// compiler to mark the variable as a "used global".
|
||||
///
|
||||
/// ```no_run
|
||||
/// #[used]
|
||||
/// static FOO: u32 = 0;
|
||||
/// ```
|
||||
/// Mark the given global value as "used", to prevent the compiler and linker from potentially
|
||||
/// removing a static variable that may otherwise appear unused.
|
||||
fn add_used_global(&self, global: Self::Value);
|
||||
|
||||
/// Same as add_used_global(), but only prevent the compiler from potentially removing an
|
||||
/// otherwise unused symbol. The linker is still permitted to drop it.
|
||||
///
|
||||
/// This corresponds to the semantics of the `#[used]` attribute.
|
||||
fn add_compiler_used_global(&self, global: Self::Value);
|
||||
}
|
||||
|
||||
pub trait StaticBuilderMethods: BackendTypes {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue