Auto merge of #71147 - cuviper:min-llvm8, r=Mark-Simulacrum

Update the minimum external LLVM to 8

LLVM 8 was released on March 20, 2019, over a year ago.
This commit is contained in:
bors 2020-04-18 01:37:27 +00:00
commit 28742a1146
30 changed files with 67 additions and 195 deletions

View File

@ -36,13 +36,13 @@ jobs:
matrix:
name:
- mingw-check
- x86_64-gnu-llvm-7
- x86_64-gnu-llvm-8
- x86_64-gnu-tools
include:
- name: mingw-check
os: ubuntu-latest-xl
env: {}
- name: x86_64-gnu-llvm-7
- name: x86_64-gnu-llvm-8
os: ubuntu-latest-xl
env: {}
- name: x86_64-gnu-tools
@ -352,7 +352,7 @@ jobs:
- x86_64-gnu-debug
- x86_64-gnu-distcheck
- x86_64-gnu-full-bootstrap
- x86_64-gnu-llvm-7
- x86_64-gnu-llvm-8
- x86_64-gnu-nopt
- x86_64-gnu-tools
- x86_64-mingw-1
@ -469,7 +469,7 @@ jobs:
- name: x86_64-gnu-full-bootstrap
os: ubuntu-latest-xl
env: {}
- name: x86_64-gnu-llvm-7
- name: x86_64-gnu-llvm-8
env:
RUST_BACKTRACE: 1
os: ubuntu-latest-xl

View File

@ -289,11 +289,11 @@ fn check_llvm_version(builder: &Builder<'_>, llvm_config: &Path) {
let version = output(cmd.arg("--version"));
let mut parts = version.split('.').take(2).filter_map(|s| s.parse::<u32>().ok());
if let (Some(major), Some(_minor)) = (parts.next(), parts.next()) {
if major >= 7 {
if major >= 8 {
return;
}
}
panic!("\n\nbad LLVM version: {}, need >=7.0\n\n", version)
panic!("\n\nbad LLVM version: {}, need >=8.0\n\n", version)
}
fn configure_cmake(

View File

@ -29,7 +29,7 @@ jobs:
- template: steps/run.yml
strategy:
matrix:
x86_64-gnu-llvm-7:
x86_64-gnu-llvm-8:
RUST_BACKTRACE: 1
dist-x86_64-linux: {}
dist-x86_64-linux-alt:

View File

@ -29,7 +29,7 @@ jobs:
- template: steps/run.yml
strategy:
matrix:
x86_64-gnu-llvm-7: {}
x86_64-gnu-llvm-8: {}
mingw-check: {}
x86_64-gnu-tools:
CI_ONLY_WHEN_SUBMODULES_CHANGED: 1

View File

@ -12,7 +12,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
cmake \
sudo \
gdb \
llvm-7-tools \
llvm-8-tools \
libedit-dev \
libssl-dev \
pkg-config \
@ -26,7 +26,7 @@ RUN sh /scripts/sccache.sh
# using llvm-link-shared due to libffi issues -- see #34486
ENV RUST_CONFIGURE_ARGS \
--build=x86_64-unknown-linux-gnu \
--llvm-root=/usr/lib/llvm-7 \
--llvm-root=/usr/lib/llvm-8 \
--enable-llvm-link-shared \
--set rust.thin-lto-import-instr-limit=10

View File

@ -259,13 +259,13 @@ jobs:
matrix:
name:
- mingw-check
- x86_64-gnu-llvm-7
- x86_64-gnu-llvm-8
- x86_64-gnu-tools
include:
- name: mingw-check
<<: *job-linux-xl
- name: x86_64-gnu-llvm-7
- name: x86_64-gnu-llvm-8
<<: *job-linux-xl
- name: x86_64-gnu-tools
@ -349,7 +349,7 @@ jobs:
- x86_64-gnu-debug
- x86_64-gnu-distcheck
- x86_64-gnu-full-bootstrap
- x86_64-gnu-llvm-7
- x86_64-gnu-llvm-8
- x86_64-gnu-nopt
- x86_64-gnu-tools
- x86_64-mingw-1
@ -471,7 +471,7 @@ jobs:
- name: x86_64-gnu-full-bootstrap
<<: *job-linux-xl
- name: x86_64-gnu-llvm-7
- name: x86_64-gnu-llvm-8
env:
RUST_BACKTRACE: 1
<<: *job-linux-xl

View File

@ -82,21 +82,12 @@ fn naked(val: &'ll Value, is_naked: bool) {
pub fn set_frame_pointer_elimination(cx: &CodegenCx<'ll, '_>, llfn: &'ll Value) {
if cx.sess().must_not_eliminate_frame_pointers() {
if llvm_util::get_major_version() >= 8 {
llvm::AddFunctionAttrStringValue(
llfn,
llvm::AttributePlace::Function,
const_cstr!("frame-pointer"),
const_cstr!("all"),
);
} else {
llvm::AddFunctionAttrStringValue(
llfn,
llvm::AttributePlace::Function,
const_cstr!("no-frame-pointer-elim"),
const_cstr!("true"),
);
}
llvm::AddFunctionAttrStringValue(
llfn,
llvm::AttributePlace::Function,
const_cstr!("frame-pointer"),
const_cstr!("all"),
);
}
}

View File

@ -16,7 +16,6 @@ use crate::llvm::debuginfo::{
DIArray, DICompositeType, DIDescriptor, DIFile, DIFlags, DILexicalBlock, DIScope, DIType,
DebugEmissionKind,
};
use crate::llvm_util;
use crate::value::Value;
use log::debug;
@ -1289,22 +1288,11 @@ fn prepare_union_metadata(
// Enums
//=-----------------------------------------------------------------------------
/// DWARF variant support is only available starting in LLVM 8.
/// Although the earlier enum debug info output did not work properly
/// in all situations, it is better for the time being to continue to
/// sometimes emit the old style rather than emit something completely
/// useless when rust is compiled against LLVM 6 or older. LLVM 7
/// contains an early version of the DWARF variant support, and will
/// crash when handling the new debug info format. This function
/// decides which representation will be emitted.
/// DWARF variant support is only available starting in LLVM 8, but
/// on MSVC we have to use the fallback mode, because LLVM doesn't
/// lower variant parts to PDB.
fn use_enum_fallback(cx: &CodegenCx<'_, '_>) -> bool {
// On MSVC we have to use the fallback mode, because LLVM doesn't
// lower variant parts to PDB.
cx.sess().target.target.options.is_like_msvc
// LLVM version 7 did not release with an important bug fix;
// but the required patch is in the LLVM 8. Rust LLVM reports
// 8 as well.
|| llvm_util::get_major_version() < 8
}
// FIXME(eddyb) maybe precompute this? Right now it's computed once

View File

@ -2,7 +2,6 @@ use crate::abi::{Abi, FnAbi, LlvmType, PassMode};
use crate::builder::Builder;
use crate::context::CodegenCx;
use crate::llvm;
use crate::llvm_util;
use crate::type_::Type;
use crate::type_of::LayoutLlvmExt;
use crate::va_arg::emit_va_arg;
@ -11,7 +10,7 @@ use crate::value::Value;
use rustc_ast::ast;
use rustc_codegen_ssa::base::{compare_simd_types, to_immediate, wants_msvc_seh};
use rustc_codegen_ssa::common::span_invalid_monomorphization_error;
use rustc_codegen_ssa::common::{IntPredicate, TypeKind};
use rustc_codegen_ssa::common::TypeKind;
use rustc_codegen_ssa::glue;
use rustc_codegen_ssa::mir::operand::{OperandRef, OperandValue};
use rustc_codegen_ssa::mir::place::PlaceRef;
@ -461,46 +460,14 @@ impl IntrinsicCallMethods<'tcx> for Builder<'a, 'll, 'tcx> {
let is_add = name == "saturating_add";
let lhs = args[0].immediate();
let rhs = args[1].immediate();
if llvm_util::get_major_version() >= 8 {
let llvm_name = &format!(
"llvm.{}{}.sat.i{}",
if signed { 's' } else { 'u' },
if is_add { "add" } else { "sub" },
width
);
let llfn = self.get_intrinsic(llvm_name);
self.call(llfn, &[lhs, rhs], None)
} else {
let llvm_name = &format!(
"llvm.{}{}.with.overflow.i{}",
if signed { 's' } else { 'u' },
if is_add { "add" } else { "sub" },
width
);
let llfn = self.get_intrinsic(llvm_name);
let pair = self.call(llfn, &[lhs, rhs], None);
let val = self.extract_value(pair, 0);
let overflow = self.extract_value(pair, 1);
let llty = self.type_ix(width);
let limit = if signed {
let limit_lo = self
.const_uint_big(llty, (i128::MIN >> (128 - width)) as u128);
let limit_hi = self
.const_uint_big(llty, (i128::MAX >> (128 - width)) as u128);
let neg = self.icmp(
IntPredicate::IntSLT,
val,
self.const_uint(llty, 0),
);
self.select(neg, limit_hi, limit_lo)
} else if is_add {
self.const_uint_big(llty, u128::MAX >> (128 - width))
} else {
self.const_uint(llty, 0)
};
self.select(overflow, limit, val)
}
let llvm_name = &format!(
"llvm.{}{}.sat.i{}",
if signed { 's' } else { 'u' },
if is_add { "add" } else { "sub" },
width
);
let llfn = self.get_intrinsic(llvm_name);
self.call(llfn, &[lhs, rhs], None)
}
_ => bug!(),
},

View File

@ -83,17 +83,15 @@ unsafe fn configure_llvm(sess: &Session) {
if !sess.opts.debugging_opts.no_generate_arange_section {
add("-generate-arange-section", false);
}
if get_major_version() >= 8 {
match sess
.opts
.debugging_opts
.merge_functions
.unwrap_or(sess.target.target.options.merge_functions)
{
MergeFunctions::Disabled | MergeFunctions::Trampolines => {}
MergeFunctions::Aliases => {
add("-mergefunc-use-aliases", false);
}
match sess
.opts
.debugging_opts
.merge_functions
.unwrap_or(sess.target.target.options.merge_functions)
{
MergeFunctions::Disabled | MergeFunctions::Trampolines => {}
MergeFunctions::Aliases => {
add("-mergefunc-use-aliases", false);
}
}

View File

@ -33,10 +33,8 @@
#include "llvm/Transforms/Instrumentation/AddressSanitizer.h"
#include "llvm/Support/TimeProfiler.h"
#endif
#if LLVM_VERSION_GE(8, 0)
#include "llvm/Transforms/Instrumentation/ThreadSanitizer.h"
#include "llvm/Transforms/Instrumentation/MemorySanitizer.h"
#endif
#if LLVM_VERSION_GE(9, 0)
#include "llvm/Transforms/Utils/CanonicalizeAliases.h"
#endif
@ -138,19 +136,13 @@ extern "C" LLVMPassRef LLVMRustCreateMemorySanitizerPass(int TrackOrigins, bool
return wrap(createMemorySanitizerLegacyPassPass(
MemorySanitizerOptions{TrackOrigins, Recover, CompileKernel}));
#elif LLVM_VERSION_GE(8, 0)
return wrap(createMemorySanitizerLegacyPassPass(TrackOrigins, Recover));
#else
return wrap(createMemorySanitizerPass(TrackOrigins, Recover));
return wrap(createMemorySanitizerLegacyPassPass(TrackOrigins, Recover));
#endif
}
extern "C" LLVMPassRef LLVMRustCreateThreadSanitizerPass() {
#if LLVM_VERSION_GE(8, 0)
return wrap(createThreadSanitizerLegacyPassPass());
#else
return wrap(createThreadSanitizerPass());
#endif
}
extern "C" LLVMRustPassKind LLVMRustPassKind(LLVMPassRef RustPass) {
@ -1236,15 +1228,11 @@ LLVMRustCreateThinLTOData(LLVMRustThinLTOModule *modules,
auto deadIsPrevailing = [&](GlobalValue::GUID G) {
return PrevailingType::Unknown;
};
#if LLVM_VERSION_GE(8, 0)
// We don't have a complete picture in our use of ThinLTO, just our immediate
// crate, so we need `ImportEnabled = false` to limit internalization.
// Otherwise, we sometimes lose `static` values -- see #60184.
computeDeadSymbolsWithConstProp(Ret->Index, Ret->GUIDPreservedSymbols,
deadIsPrevailing, /* ImportEnabled = */ false);
#else
computeDeadSymbols(Ret->Index, Ret->GUIDPreservedSymbols, deadIsPrevailing);
#endif
ComputeCrossModuleImport(
Ret->Index,
Ret->ModuleToDefinedGVSummaries,
@ -1277,10 +1265,8 @@ LLVMRustCreateThinLTOData(LLVMRustThinLTOModule *modules,
#if LLVM_VERSION_GE(9, 0)
thinLTOResolvePrevailingInIndex(Ret->Index, isPrevailing, recordNewLinkage,
Ret->GUIDPreservedSymbols);
#elif LLVM_VERSION_GE(8, 0)
thinLTOResolvePrevailingInIndex(Ret->Index, isPrevailing, recordNewLinkage);
#else
thinLTOResolveWeakForLinkerInIndex(Ret->Index, isPrevailing, recordNewLinkage);
thinLTOResolvePrevailingInIndex(Ret->Index, isPrevailing, recordNewLinkage);
#endif
// Here we calculate an `ExportedGUIDs` set for use in the `isExported`
@ -1346,11 +1332,7 @@ extern "C" bool
LLVMRustPrepareThinLTOResolveWeak(const LLVMRustThinLTOData *Data, LLVMModuleRef M) {
Module &Mod = *unwrap(M);
const auto &DefinedGlobals = Data->ModuleToDefinedGVSummaries.lookup(Mod.getModuleIdentifier());
#if LLVM_VERSION_GE(8, 0)
thinLTOResolvePrevailingInModule(Mod, DefinedGlobals);
#else
thinLTOResolveWeakForLinkerModule(Mod, DefinedGlobals);
#endif
return true;
}

View File

@ -586,7 +586,6 @@ inline LLVMRustDISPFlags virtuality(LLVMRustDISPFlags F) {
return static_cast<LLVMRustDISPFlags>(static_cast<uint32_t>(F) & 0x3);
}
#if LLVM_VERSION_GE(8, 0)
static DISubprogram::DISPFlags fromRust(LLVMRustDISPFlags SPFlags) {
DISubprogram::DISPFlags Result = DISubprogram::DISPFlags::SPFlagZero;
@ -619,7 +618,6 @@ static DISubprogram::DISPFlags fromRust(LLVMRustDISPFlags SPFlags) {
return Result;
}
#endif
enum class LLVMRustDebugEmissionKind {
NoDebug,
@ -734,7 +732,6 @@ extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateFunction(
LLVMMetadataRef Decl) {
DITemplateParameterArray TParams =
DITemplateParameterArray(unwrap<MDTuple>(TParam));
#if LLVM_VERSION_GE(8, 0)
DISubprogram::DISPFlags llvmSPFlags = fromRust(SPFlags);
DINode::DIFlags llvmFlags = fromRust(Flags);
#if LLVM_VERSION_LT(9, 0)
@ -748,22 +745,6 @@ extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateFunction(
unwrapDI<DIFile>(File), LineNo,
unwrapDI<DISubroutineType>(Ty), ScopeLine, llvmFlags,
llvmSPFlags, TParams, unwrapDIPtr<DISubprogram>(Decl));
#else
bool IsLocalToUnit = isSet(SPFlags & LLVMRustDISPFlags::SPFlagLocalToUnit);
bool IsDefinition = isSet(SPFlags & LLVMRustDISPFlags::SPFlagDefinition);
bool IsOptimized = isSet(SPFlags & LLVMRustDISPFlags::SPFlagOptimized);
DINode::DIFlags llvmFlags = fromRust(Flags);
if (isSet(SPFlags & LLVMRustDISPFlags::SPFlagMainSubprogram))
llvmFlags |= DINode::DIFlags::FlagMainSubprogram;
DISubprogram *Sub = Builder->createFunction(
unwrapDI<DIScope>(Scope),
StringRef(Name, NameLen),
StringRef(LinkageName, LinkageNameLen),
unwrapDI<DIFile>(File), LineNo,
unwrapDI<DISubroutineType>(Ty), IsLocalToUnit, IsDefinition,
ScopeLine, llvmFlags, IsOptimized, TParams,
unwrapDIPtr<DISubprogram>(Decl));
#endif
unwrap<Function>(Fn)->setSubprogram(Sub);
return wrap(Sub);
}
@ -884,9 +865,7 @@ extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateStaticVariable(
/* isDefined */ true,
#endif
InitExpr, unwrapDIPtr<MDNode>(Decl),
#if LLVM_VERSION_GE(8, 0)
/* templateParams */ nullptr,
#endif
AlignInBits);
InitVal->setMetadata("dbg", VarExpr);
@ -1107,11 +1086,7 @@ extern "C" void LLVMRustUnpackOptimizationDiagnostic(
if (loc.isValid()) {
*Line = loc.getLine();
*Column = loc.getColumn();
#if LLVM_VERSION_GE(8, 0)
FilenameOS << loc.getAbsolutePath();
#else
FilenameOS << loc.getFilename();
#endif
}
RawRustStringOstream MessageOS(MessageOut);

View File

@ -1,18 +1,13 @@
// This test depends on a patch that was committed to upstream LLVM
// before 7.0, then backported to the Rust LLVM fork. It tests that
// debug info for "c-like" enums is properly emitted.
// This tests that debug info for "c-like" enums is properly emitted.
// This is ignored for the fallback mode on MSVC due to problems with PDB.
// ignore-tidy-linelength
// ignore-windows
// min-system-llvm-version 8.0
// ignore-msvc
// compile-flags: -g -C no-prepopulate-passes
// DIFlagFixedEnum was deprecated in 8.0, renamed to DIFlagEnumClass.
// We match either for compatibility.
// CHECK-LABEL: @main
// CHECK: {{.*}}DICompositeType{{.*}}tag: DW_TAG_enumeration_type,{{.*}}name: "E",{{.*}}flags: {{(DIFlagEnumClass|DIFlagFixedEnum)}},{{.*}}
// CHECK: {{.*}}DICompositeType{{.*}}tag: DW_TAG_enumeration_type,{{.*}}name: "E",{{.*}}flags: DIFlagEnumClass,{{.*}}
// CHECK: {{.*}}DIEnumerator{{.*}}name: "A",{{.*}}value: {{[0-9].*}}
// CHECK: {{.*}}DIEnumerator{{.*}}name: "B",{{.*}}value: {{[0-9].*}}
// CHECK: {{.*}}DIEnumerator{{.*}}name: "C",{{.*}}value: {{[0-9].*}}

View File

@ -1,10 +1,8 @@
// This test depends on a patch that was committed to upstream LLVM
// before 7.0, then backported to the Rust LLVM fork. It tests that
// optimized enum debug info accurately reflects the enum layout.
// This tests that optimized enum debug info accurately reflects the enum layout.
// This is ignored for the fallback mode on MSVC due to problems with PDB.
// ignore-tidy-linelength
// ignore-windows
// min-system-llvm-version 8.0
// ignore-msvc
// compile-flags: -g -C no-prepopulate-passes

View File

@ -1,9 +1,7 @@
// This test depends on a patch that was committed to upstream LLVM
// before 7.0, then backported to the Rust LLVM fork. It tests that
// optimized enum debug info accurately reflects the enum layout.
// This tests that optimized enum debug info accurately reflects the enum layout.
// This is ignored for the fallback mode on MSVC due to problems with PDB.
// ignore-windows
// min-system-llvm-version 8.0
// ignore-msvc
// compile-flags: -g -C no-prepopulate-passes

View File

@ -1,9 +1,7 @@
// This test depends on a patch that was committed to upstream LLVM
// before 7.0, then backported to the Rust LLVM fork. It tests that
// debug info for tagged (ordinary) enums is properly emitted.
// This tests that debug info for tagged (ordinary) enums is properly emitted.
// This is ignored for the fallback mode on MSVC due to problems with PDB.
// ignore-windows
// min-system-llvm-version 8.0
// ignore-msvc
// compile-flags: -g -C no-prepopulate-passes

View File

@ -1,4 +1,3 @@
// min-llvm-version 8.0
// compile-flags: -C no-prepopulate-passes -C force-frame-pointers=y
#![crate_type="lib"]

View File

@ -1,4 +1,3 @@
// min-llvm-version 8.0
// ignore-tidy-linelength
// compile-flags: -Z instrument-mcount

View File

@ -1,7 +1,6 @@
// ignore-tidy-linelength
// Require LLVM with DW_TAG_variant_part and a gdb or lldb that can read it.
// min-system-llvm-version: 8.0
// Require a gdb or lldb that can read DW_TAG_variant_part.
// min-gdb-version: 8.2
// rust-lldb

View File

@ -1,5 +1,4 @@
// Require LLVM with DW_TAG_variant_part and a gdb that can read it.
// min-system-llvm-version: 8.0
// Require a gdb that can read DW_TAG_variant_part.
// min-gdb-version: 8.2
// compile-flags:-g -Z thinlto

View File

@ -1,7 +1,6 @@
// ignore-tidy-linelength
// Require LLVM with DW_TAG_variant_part and a gdb that can read it.
// min-system-llvm-version: 8.0
// Require a gdb that can read DW_TAG_variant_part.
// min-gdb-version: 8.2
// compile-flags:-g

View File

@ -1,8 +1,7 @@
// ignore-lldb: FIXME(#27089)
// min-lldb-version: 310
// Require LLVM with DW_TAG_variant_part and a gdb that can read it.
// min-system-llvm-version: 8.0
// Require a gdb that can read DW_TAG_variant_part.
// min-gdb-version: 8.2
// compile-flags:-g

View File

@ -1,8 +1,7 @@
// ignore-tidy-linelength
// min-lldb-version: 310
// Require LLVM with DW_TAG_variant_part and a gdb that can read it.
// min-system-llvm-version: 8.0
// Require a gdb that can read DW_TAG_variant_part.
// min-gdb-version: 8.2
// compile-flags:-g

View File

@ -1,8 +1,6 @@
// ignore-tidy-linelength
// Require LLVM with DW_TAG_variant_part and a gdb and lldb that can
// read it.
// min-system-llvm-version: 8.0
// Require a gdb or lldb that can read DW_TAG_variant_part.
// min-gdb-version: 8.2
// rust-lldb

View File

@ -1,8 +1,7 @@
// This test makes sure that the LLDB pretty printer does not throw an exception
// for nested closures and generators.
// Require LLVM with DW_TAG_variant_part and a gdb that can read it.
// min-system-llvm-version: 8.0
// Require a gdb that can read DW_TAG_variant_part.
// min-gdb-version: 8.2
// ignore-tidy-linelength

View File

@ -1,7 +1,6 @@
// ignore-lldb
// Require LLVM with DW_TAG_variant_part and a gdb that can read it.
// min-system-llvm-version: 8.0
// Require a gdb that can read DW_TAG_variant_part.
// min-gdb-version: 8.2
// compile-flags:-g

View File

@ -1,8 +1,6 @@
// ignore-tidy-linelength
// Require LLVM with DW_TAG_variant_part and a gdb and lldb that can
// read it.
// min-system-llvm-version: 8.0
// Require a gdb or lldb that can read DW_TAG_variant_part.
// min-gdb-version: 8.2
// rust-lldb

View File

@ -1,8 +1,6 @@
// ignore-tidy-linelength
// Require LLVM with DW_TAG_variant_part and a gdb and lldb that can
// read it.
// min-system-llvm-version: 8.0
// Require a gdb or lldb that can read DW_TAG_variant_part.
// min-gdb-version: 8.2
// rust-lldb

View File

@ -1,6 +1,4 @@
// Require LLVM with DW_TAG_variant_part and a gdb and lldb that can
// read it.
// min-system-llvm-version: 8.0
// Require a gdb or lldb that can read DW_TAG_variant_part.
// min-gdb-version: 8.2
// rust-lldb

View File

@ -1,6 +1,5 @@
// run-pass
// ignore-emscripten
// min-llvm-version 8.0
#![allow(non_camel_case_types)]
#![feature(repr_simd, platform_intrinsics)]