Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[LLVM] drop support for LLVM 8 #38015

Merged
merged 2 commits into from
Oct 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions src/ccall.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1833,12 +1833,7 @@ jl_cgval_t function_sig_t::emit_a_ccall(
bool f_extern = (strncmp(f_name, "extern ", 7) == 0);
if (f_extern)
f_name += 7;
llvmf = jl_Module->getOrInsertFunction(f_name, functype)
#if JL_LLVM_VERSION >= 90000
.getCallee();
#else
;
#endif
llvmf = jl_Module->getOrInsertFunction(f_name, functype).getCallee();
if (!f_extern && (!isa<Function>(llvmf) ||
cast<Function>(llvmf)->getIntrinsicID() ==
Intrinsic::not_intrinsic)) {
Expand Down
13 changes: 1 addition & 12 deletions src/clangsa/GCChecker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,11 +235,7 @@ class GCChecker
public:
void checkBeginFunction(CheckerContext &Ctx) const;
void checkEndFunction(const clang::ReturnStmt *RS, CheckerContext &Ctx) const;
#if LLVM_VERSION_MAJOR >= 9
bool evalCall(const CallEvent &Call, CheckerContext &C) const;
#else
bool evalCall(const CallExpr *CE, CheckerContext &C) const;
#endif
void checkPreCall(const CallEvent &Call, CheckerContext &C) const;
void checkPostCall(const CallEvent &Call, CheckerContext &C) const;
void checkPostStmt(const CStyleCastExpr *CE, CheckerContext &C) const;
Expand Down Expand Up @@ -1296,19 +1292,12 @@ void GCChecker::checkPreCall(const CallEvent &Call, CheckerContext &C) const {
}
}

#if LLVM_VERSION_MAJOR >= 9
bool GCChecker::evalCall(const CallEvent &Call,
#else
bool GCChecker::evalCall(const CallExpr *CE,
#endif
CheckerContext &C) const {
bool GCChecker::evalCall(const CallEvent &Call, CheckerContext &C) const {
// These checks should have no effect on the surrounding environment
// (globals should not be invalidated, etc), hence the use of evalCall.
#if LLVM_VERSION_MAJOR >= 9
const CallExpr *CE = dyn_cast<CallExpr>(Call.getOriginExpr());
if (!CE)
return false;
#endif
unsigned CurrentDepth = C.getState()->get<GCDepth>();
auto name = C.getCalleeName(CE);
if (name == "JL_GC_POP") {
Expand Down
39 changes: 6 additions & 33 deletions src/codegen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3376,11 +3376,8 @@ static jl_cgval_t emit_call_specfun_other(jl_codectx_t &ctx, jl_method_instance_
static jl_cgval_t emit_call_specfun_boxed(jl_codectx_t &ctx, StringRef specFunctionObject,
jl_cgval_t *argv, size_t nargs, jl_value_t *inferred_retty)
{
auto theFptr = cast<Function>(jl_Module->getOrInsertFunction(specFunctionObject, jl_func_sig)
#if JL_LLVM_VERSION >= 90000
.getCallee()
#endif
);
auto theFptr = cast<Function>(
jl_Module->getOrInsertFunction(specFunctionObject, jl_func_sig).getCallee());
add_return_attr(theFptr, Attribute::NonNull);
theFptr->addFnAttr(Thunk);
Value *ret = emit_jlcall(ctx, theFptr, nullptr, argv, nargs, JLCALL_F_CC);
Expand Down Expand Up @@ -4608,11 +4605,8 @@ static Function *emit_tojlinvoke(jl_code_instance_t *codeinst, Module *M, jl_cod
Value *theFarg;
if (codeinst->invoke != NULL) {
StringRef theFptrName = jl_ExecutionEngine->getFunctionAtAddress((uintptr_t)codeinst->invoke, codeinst);
theFunc = cast<Function>(M->getOrInsertFunction(theFptrName, jlinvoke_func->_type(jl_LLVMContext))
#if JL_LLVM_VERSION >= 90000
.getCallee()
#endif
);
theFunc = cast<Function>(
M->getOrInsertFunction(theFptrName, jlinvoke_func->_type(jl_LLVMContext)).getCallee());
theFarg = literal_pointer_val(ctx, (jl_value_t*)codeinst);
}
else {
Expand Down Expand Up @@ -6878,14 +6872,7 @@ static std::pair<std::unique_ptr<Module>, jl_llvm_functions_t>
FromBB->getName() + "." + PhiBB->getName() + "_crit_edge");
Function::iterator FBBI = FromBB->getIterator();
ctx.f->getBasicBlockList().insert(++FBBI, NewBB); // insert after existing block
#if JL_LLVM_VERSION >= 90000
terminator->replaceSuccessorWith(PhiBB, NewBB);
#else
for (unsigned Idx = 0, NumSuccessors = terminator->getNumSuccessors(); Idx != NumSuccessors; ++Idx) {
if (terminator->getSuccessor(Idx) == PhiBB)
terminator->setSuccessor(Idx, NewBB);
}
#endif
DebugLoc Loc = terminator->getDebugLoc();
terminator = BranchInst::Create(PhiBB);
terminator->setDebugLoc(Loc);
Expand Down Expand Up @@ -6987,17 +6974,7 @@ static std::pair<std::unique_ptr<Module>, jl_llvm_functions_t>
if (FromBB != NewBB) {
BB_rewrite_map[LookupKey] = NewBB;
preds.insert(NewBB);
#if JL_LLVM_VERSION >= 90000
PhiBB->replacePhiUsesWith(FromBB, NewBB);
#else
for (BasicBlock::iterator I = PhiBB->begin(); isa<PHINode>(I); ++I) {
PHINode *PN = cast<PHINode>(I);
ssize_t BBIdx = PN->getBasicBlockIndex(FromBB);
if (BBIdx == -1)
continue;
PN->setIncomingBlock(BBIdx, NewBB);
}
#endif
}
ctx.builder.ClearInsertionPoint();
}
Expand Down Expand Up @@ -7724,8 +7701,6 @@ extern "C" void jl_init_llvm(void)
// Make sure we are using the large code model on 64bit
// Let LLVM pick a default suitable for jitting on 32bit
CodeModel::Large;
#elif JL_LLVM_VERSION < 60000
CodeModel::JITDefault;
#else
None;
#endif
Expand All @@ -7735,10 +7710,8 @@ extern "C" void jl_init_llvm(void)
options,
Reloc::Static, // Generate simpler code for JIT
codemodel,
optlevel
#if JL_LLVM_VERSION >= 60000
, /*JIT*/ true
#endif
optlevel,
true // JIT
);
assert(jl_TargetMachine && "Failed to select target machine -"
" Is the LLVM backend for this CPU enabled?");
Expand Down
8 changes: 1 addition & 7 deletions src/debuginfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -647,15 +647,9 @@ static debug_link_info getDebuglink(const object::ObjectFile &Obj) JL_NOTSAFEPOI
if (!Section.getName(sName) && sName == ".gnu_debuglink")
#endif
{
StringRef Contents;
#if JL_LLVM_VERSION >= 90000
auto found = Section.getContents();
if (found)
Contents = *found;
#else
bool found = !Section.getContents(Contents);
#endif
if (found) {
StringRef Contents = *found;
size_t length = Contents.find('\0');
info.filename = Contents.substr(0, length);
info.crc32 = *(const uint32_t*)Contents.substr(LLT_ALIGN(length + 1, 4), 4).data();
Expand Down
7 changes: 0 additions & 7 deletions src/debuginfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,8 @@ int jl_DI_for_fptr(uint64_t fptr, uint64_t *symsize, int64_t *slide,
bool jl_dylib_DI_for_fptr(size_t pointer, llvm::object::SectionRef *Section, int64_t *slide, llvm::DIContext **context,
bool onlySysImg, bool *isSysImg, void **saddr, char **name, char **filename) JL_NOTSAFEPOINT;

#if JL_LLVM_VERSION >= 90000
static object::SectionedAddress makeAddress(
llvm::object::SectionRef Section, uint64_t address) JL_NOTSAFEPOINT
{
return object::SectionedAddress{address, Section.getIndex()};
}
#else
static uint64_t makeAddress(llvm::object::SectionRef Section, uint64_t address) JL_NOTSAFEPOINT
{
return address;
}
#endif
10 changes: 5 additions & 5 deletions src/features_aarch64.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ JL_FEATURE_DEF(pa, 30, 0) // HWCAP_PACA

// hwcap2
JL_FEATURE_DEF(ccdp, 32 + 0, 0) // HWCAP2_DCPODP, ARMv8.2-DCCVADP. Required in ARMv8.5
JL_FEATURE_DEF(sve2, 32 + 1, 90000) // HWCAP2_SVE2
// JL_FEATURE_DEF_NAME(sve2_aes, 32 + 2, 90000, "sve2-aes") // HWCAP2_SVEAES, Implied by `sve2-aes`
JL_FEATURE_DEF_NAME(sve2_aes, 32 + 3, 90000, "sve2-aes") // HWCAP2_SVEPMULL, ID_AA64ZFR0_EL1.AES == 2
JL_FEATURE_DEF(sve2, 32 + 1, 0) // HWCAP2_SVE2
// JL_FEATURE_DEF_NAME(sve2_aes, 32 + 2, 0, "sve2-aes") // HWCAP2_SVEAES, Implied by `sve2-aes`
JL_FEATURE_DEF_NAME(sve2_aes, 32 + 3, 0, "sve2-aes") // HWCAP2_SVEPMULL, ID_AA64ZFR0_EL1.AES == 2
JL_FEATURE_DEF_NAME(sve2_bitperm, 32 + 4, 100000, "sve2-bitperm") // HWCAP2_SVEBITPERM
JL_FEATURE_DEF_NAME(sve2_sha3, 32 + 5, 90000, "sve2-sha3") // HWCAP2_SVESHA3
JL_FEATURE_DEF_NAME(sve2_sm4, 32 + 6, 90000, "sve2-sm4") // HWCAP2_SM4
JL_FEATURE_DEF_NAME(sve2_sha3, 32 + 5, 0, "sve2-sha3") // HWCAP2_SVESHA3
JL_FEATURE_DEF_NAME(sve2_sm4, 32 + 6, 0, "sve2-sm4") // HWCAP2_SM4
JL_FEATURE_DEF(altnzcv, 32 + 7, 0) // HWCAP2_FLAGM2, ARMv8.5-CondM. Required in ARMv8.5
JL_FEATURE_DEF(fptoint, 32 + 8, 0) // HWCAP2_FRINT. Required in ARMv8.5
// JL_FEATURE_DEF(svei8mm, 32 + 9, UINT32_MAX) // HWCAP2_SVEI8MM, ARMv8.2-I8MM. Same as `i8mm`
Expand Down
6 changes: 3 additions & 3 deletions src/features_x86.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,12 @@ JL_FEATURE_DEF(rdpid, 32 * 3 + 22, 0)
JL_FEATURE_DEF(cldemote, 32 * 3 + 25, 0)
JL_FEATURE_DEF(movdiri, 32 * 3 + 27, 0)
JL_FEATURE_DEF(movdir64b, 32 * 3 + 28, 0)
JL_FEATURE_DEF(enqcmd, 32 * 3 + 29, 90000)
JL_FEATURE_DEF(enqcmd, 32 * 3 + 29, 0)

// EAX=7,ECX=0: EDX
// JL_FEATURE_DEF(avx5124vnniw, 32 * 4 + 2, ?????)
// JL_FEATURE_DEF(avx5124fmaps, 32 * 4 + 3, ?????)
JL_FEATURE_DEF(avx512vp2intersect, 32 * 4 + 8, 90000)
JL_FEATURE_DEF(avx512vp2intersect, 32 * 4 + 8, 0)
JL_FEATURE_DEF(serialize, 32 * 4 + 14, 110000)
JL_FEATURE_DEF(tsxldtrk, 32 * 4 + 16, 110000)
JL_FEATURE_DEF(pconfig, 32 * 4 + 18, 0)
Expand Down Expand Up @@ -108,7 +108,7 @@ JL_FEATURE_DEF(clzero, 32 * 8 + 0, 0)
JL_FEATURE_DEF(wbnoinvd, 32 * 8 + 9, 0)

// EAX=7,ECX=1: EAX
JL_FEATURE_DEF(avx512bf16, 32 * 9 + 5, 90000)
JL_FEATURE_DEF(avx512bf16, 32 * 9 + 5, 0)

// EAX=0x14,ECX=0: EBX
JL_FEATURE_DEF(ptwrite, 32 * 10 + 4, 0)
Expand Down
10 changes: 0 additions & 10 deletions src/llvm-alloc-opt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -884,19 +884,9 @@ void Optimizer::replaceIntrinsicUseWith(IntrinsicInst *call, Intrinsic::ID ID,
SmallVector<Intrinsic::IITDescriptor, 8> Table;
getIntrinsicInfoTableEntries(ID, Table);
ArrayRef<Intrinsic::IITDescriptor> TableRef = Table;
#if JL_LLVM_VERSION >= 90000
auto res = Intrinsic::matchIntrinsicSignature(newfType, TableRef, overloadTys);
assert(res == Intrinsic::MatchIntrinsicTypes_Match);
(void)res;
#else
bool res = Intrinsic::matchIntrinsicType(oldfType->getReturnType(), TableRef, overloadTys);
assert(!res);
for (auto Ty : newfType->params()) {
res = Intrinsic::matchIntrinsicType(Ty, TableRef, overloadTys);
assert(!res);
}
(void)res;
#endif
bool matchvararg = Intrinsic::matchIntrinsicVarArg(newfType->isVarArg(), TableRef);
assert(!matchvararg);
(void)matchvararg;
Expand Down
4 changes: 2 additions & 2 deletions src/llvm-version.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
#define JL_LLVM_VERSION (LLVM_VERSION_MAJOR * 10000 + LLVM_VERSION_MINOR * 100 \
+ LLVM_VERSION_PATCH)

#if JL_LLVM_VERSION < 80000
#error Only LLVM versions >= 8.0.0 are supported by Julia
#if JL_LLVM_VERSION < 90000
#error Only LLVM versions >= 9.0.0 are supported by Julia
#endif
#if JL_LLVM_VERSION < 100000
#define Align(a) (a)
Expand Down
19 changes: 4 additions & 15 deletions src/processor_arm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -365,8 +365,8 @@ static constexpr CPUSpec<CPU, feature_sz> cpus[] = {
{"cortex-a72", CPU::arm_cortex_a72, CPU::generic, 0, Feature::arm_cortex_a72},
{"cortex-a73", CPU::arm_cortex_a73, CPU::generic, 0, Feature::arm_cortex_a73},
{"cortex-a75", CPU::arm_cortex_a75, CPU::generic, 0, Feature::arm_cortex_a75},
{"cortex-a76", CPU::arm_cortex_a76, CPU::arm_cortex_a75, 90000, Feature::arm_cortex_a76},
{"cortex-a76ae", CPU::arm_cortex_a76ae, CPU::arm_cortex_a75, 90000, Feature::arm_cortex_a76},
{"cortex-a76", CPU::arm_cortex_a76, CPU::generic, 0, Feature::arm_cortex_a76},
{"cortex-a76ae", CPU::arm_cortex_a76ae, CPU::generic, 0, Feature::arm_cortex_a76},
{"cortex-a77", CPU::arm_cortex_a77, CPU::arm_cortex_a76, 110000, Feature::arm_cortex_a77},
{"cortex-a78", CPU::arm_cortex_a78, CPU::arm_cortex_a77, 110000, Feature::arm_cortex_a78},
{"cortex-x1", CPU::arm_cortex_x1, CPU::arm_cortex_a78, 110000, Feature::arm_cortex_x1},
Expand Down Expand Up @@ -642,8 +642,8 @@ static constexpr CPUSpec<CPU, feature_sz> cpus[] = {
{"cortex-a72", CPU::arm_cortex_a72, CPU::generic, 0, Feature::arm_cortex_a72},
{"cortex-a73", CPU::arm_cortex_a73, CPU::generic, 0, Feature::arm_cortex_a73},
{"cortex-a75", CPU::arm_cortex_a75, CPU::generic, 0, Feature::arm_cortex_a75},
{"cortex-a76", CPU::arm_cortex_a76, CPU::arm_cortex_a75, 90000, Feature::arm_cortex_a76},
{"cortex-a76ae", CPU::arm_cortex_a76ae, CPU::arm_cortex_a75, 90000, Feature::arm_cortex_a76},
{"cortex-a76", CPU::arm_cortex_a76, CPU::generic, 0, Feature::arm_cortex_a76},
{"cortex-a76ae", CPU::arm_cortex_a76ae, CPU::generic, 0, Feature::arm_cortex_a76},
{"cortex-a77", CPU::arm_cortex_a77, CPU::arm_cortex_a76, 110000, Feature::arm_cortex_a77},
{"cortex-a78", CPU::arm_cortex_a78, CPU::arm_cortex_a77, 110000, Feature::arm_cortex_a78},
{"cortex-x1", CPU::arm_cortex_x1, CPU::arm_cortex_a78, 110000, Feature::arm_cortex_x1},
Expand Down Expand Up @@ -1616,17 +1616,6 @@ get_llvm_target_noext(const TargetData<feature_sz> &data)
const char *fename_str = fename.name;
bool enable = test_nbit(features, fename.bit);
bool disable = test_nbit(data.dis.features, fename.bit);
#if defined(_CPU_ARM_) && JL_LLVM_VERSION < 90000
if (fename.bit == Feature::d32) {
if (enable) {
feature_strs.push_back("-d16");
}
else if (disable) {
feature_strs.push_back("+d16");
}
continue;
}
#endif
if (enable) {
feature_strs.insert(feature_strs.begin(), std::string("+") + fename_str);
}
Expand Down
7 changes: 2 additions & 5 deletions src/processor_x86.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,7 @@ static constexpr CPUSpec<CPU, feature_sz> cpus[] = {
{"knm", CPU::intel_knights_mill, CPU::generic, 0, Feature::knm},
{"skylake-avx512", CPU::intel_corei7_skylake_avx512, CPU::generic, 0, Feature::skx},
{"cascadelake", CPU::intel_corei7_cascadelake, CPU::generic, 0, Feature::cascadelake},
{"cooperlake", CPU::intel_corei7_cooperlake, CPU::intel_corei7_cascadelake,
90000, Feature::cooperlake},
{"cooperlake", CPU::intel_corei7_cooperlake, CPU::generic, 0, Feature::cooperlake},
{"cannonlake", CPU::intel_corei7_cannonlake, CPU::generic, 0, Feature::cannonlake},
{"icelake-client", CPU::intel_corei7_icelake_client, CPU::generic, 0, Feature::icelake},
{"icelake-server", CPU::intel_corei7_icelake_server, CPU::generic, 0,
Expand Down Expand Up @@ -288,7 +287,7 @@ static constexpr CPUSpec<CPU, feature_sz> cpus[] = {
{"bdver4", CPU::amd_bdver4, CPU::generic, 0, Feature::bdver4},

{"znver1", CPU::amd_znver1, CPU::generic, 0, Feature::znver1},
{"znver2", CPU::amd_znver2, CPU::amd_znver1, 90000, Feature::znver2},
{"znver2", CPU::amd_znver2, CPU::generic, 0, Feature::znver2},
};
static constexpr size_t ncpu_names = sizeof(cpus) / sizeof(cpus[0]);

Expand Down Expand Up @@ -969,9 +968,7 @@ get_llvm_target_noext(const TargetData<feature_sz> &data)
// This can happen with virtualization.
features.push_back("+64bit");
#endif
#if JL_LLVM_VERSION >= 90000
features.push_back("+cx8");
#endif
return std::make_pair(std::move(name), std::move(features));
}

Expand Down