From 9669eecc99bc4553e28d94d7dd3dc9fd40b3bf3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mos=C3=A8=20Giordano?= Date: Mon, 29 Jan 2024 08:34:37 +0000 Subject: [PATCH] Drop support for LLVM 14 (#53094) --- src/cgutils.cpp | 2 -- src/codegen.cpp | 9 --------- src/disasm.cpp | 19 ------------------- src/jitlayers.cpp | 6 +----- src/jitlayers.h | 10 +--------- src/pipeline.cpp | 3 --- 6 files changed, 2 insertions(+), 47 deletions(-) diff --git a/src/cgutils.cpp b/src/cgutils.cpp index b4716b13f2dd1..2a53cf0528694 100644 --- a/src/cgutils.cpp +++ b/src/cgutils.cpp @@ -3489,10 +3489,8 @@ static Value *emit_allocobj(jl_codectx_t &ctx, size_t static_size, Value *jt, if (static_size > 0) call->addRetAttr(Attribute::getWithDereferenceableBytes(call->getContext(), static_size)); call->addRetAttr(Attribute::getWithAlignment(call->getContext(), Align(align))); -#if JL_LLVM_VERSION >= 150000 if (fully_initialized) call->addFnAttr(Attribute::get(call->getContext(), Attribute::AllocKind, uint64_t(AllocFnKind::Alloc | AllocFnKind::Uninitialized))); -#endif return call; } diff --git a/src/codegen.cpp b/src/codegen.cpp index 39f938ea313e8..c91e70b5e508e 100644 --- a/src/codegen.cpp +++ b/src/codegen.cpp @@ -1051,9 +1051,7 @@ static const auto jl_alloc_obj_func = new JuliaFunction{ [](LLVMContext &C) { auto FnAttrs = AttrBuilder(C); FnAttrs.addAllocSizeAttr(1, None); // returns %1 bytes -#if JL_LLVM_VERSION >= 150000 FnAttrs.addAllocKindAttr(AllocFnKind::Alloc); -#endif #if JL_LLVM_VERSION >= 160000 FnAttrs.addMemoryAttr(MemoryEffects::argMemOnly(ModRefInfo::Ref) | MemoryEffects::inaccessibleMemOnly(ModRefInfo::ModRef)); #endif @@ -2628,11 +2626,7 @@ static void jl_init_function(Function *F, const Triple &TT) attr.addStackAlignmentAttr(16); } if (TT.isOSWindows() && TT.getArch() == Triple::x86_64) { -#if JL_LLVM_VERSION < 150000 - attr.addAttribute(Attribute::UWTable); // force NeedsWinEH -#else attr.addUWTableAttr(llvm::UWTableKind::Default); // force NeedsWinEH -#endif } if (jl_fpo_disabled(TT)) attr.addAttribute("frame-pointer", "all"); @@ -9580,9 +9574,6 @@ extern "C" void jl_init_llvm(void) // Initialize passes PassRegistry &Registry = *PassRegistry::getPassRegistry(); initializeCore(Registry); -#if JL_LLVM_VERSION < 150000 - initializeCoroutines(Registry); -#endif initializeScalarOpts(Registry); initializeVectorization(Registry); initializeAnalysis(Registry); diff --git a/src/disasm.cpp b/src/disasm.cpp index 57896dc2ee4d8..c2a55f23d12f2 100644 --- a/src/disasm.cpp +++ b/src/disasm.cpp @@ -797,11 +797,7 @@ static const char *SymbolLookup(void *DisInfo, uint64_t ReferenceValue, uint64_t static int OpInfoLookup(void *DisInfo, uint64_t PC, uint64_t Offset, -#if JL_LLVM_VERSION < 150000 - uint64_t Size, -#else uint64_t OpSize, uint64_t InstSize, -#endif int TagType, void *TagBuf) { // SymbolTable *SymTab = (SymbolTable*)DisInfo; @@ -910,11 +906,7 @@ static void jl_dump_asm_internal( std::unique_ptr CE; std::unique_ptr MAB; if (ShowEncoding) { -#if JL_LLVM_VERSION >= 150000 CE.reset(TheTarget->createMCCodeEmitter(*MCII, Ctx)); -#else - CE.reset(TheTarget->createMCCodeEmitter(*MCII, *MRI, Ctx)); -#endif MAB.reset(TheTarget->createMCAsmBackend(*STI, *MRI, Options)); } @@ -929,11 +921,7 @@ static void jl_dump_asm_internal( IP.release(), std::move(CE), std::move(MAB), /*ShowInst*/ false)); -#if JL_LLVM_VERSION >= 140000 Streamer->initSections(true, *STI); -#else - Streamer->InitSections(true); -#endif // Make the MemoryObject wrapper ArrayRef memoryObject(const_cast((const uint8_t*)Fptr),Fsize); @@ -1049,9 +1037,6 @@ static void jl_dump_asm_internal( MCInst Inst; MCDisassembler::DecodeStatus S; FuncMCView view = memoryObject.slice(Index); -#if JL_LLVM_VERSION < 150000 -#define getCommentOS() GetCommentOS() -#endif S = DisAsm->getInstruction(Inst, insSize, view, 0, /*CStream*/ pass != 0 ? Streamer->getCommentOS () : nulls()); if (pass != 0 && Streamer->getCommentOS ().tell() > 0) @@ -1256,11 +1241,7 @@ jl_value_t *jl_dump_function_asm_impl(jl_llvmf_dump_t* dump, char emit_mc, const STI, MRI, TM->Options.MCOptions)); std::unique_ptr MCE; if (binary) { // enable MCAsmStreamer::AddEncodingComment printing -#if JL_LLVM_VERSION >= 150000 MCE.reset(TM->getTarget().createMCCodeEmitter(MII, *Context)); -#else - MCE.reset(TM->getTarget().createMCCodeEmitter(MII, MRI, *Context)); -#endif } auto FOut = std::make_unique(asmfile); std::unique_ptr S(TM->getTarget().createAsmStreamer( diff --git a/src/jitlayers.cpp b/src/jitlayers.cpp index 8521ab5502f32..cb6267866eac1 100644 --- a/src/jitlayers.cpp +++ b/src/jitlayers.cpp @@ -41,9 +41,7 @@ using namespace llvm; # include # include # include -# if JL_LLVM_VERSION >= 150000 # include -# endif # include #define DEBUG_TYPE "julia_jitlayers" @@ -1006,9 +1004,7 @@ class JLMemoryUsagePlugin : public ObjectLinkingLayer::Plugin { // TODO: Port our memory management optimisations to JITLink instead of using the // default InProcessMemoryManager. std::unique_ptr createJITLinkMemoryManager() { -#if JL_LLVM_VERSION < 150000 - return cantFail(jitlink::InProcessMemoryManager::Create()); -#elif JL_LLVM_VERSION < 160000 +#if JL_LLVM_VERSION < 160000 return cantFail(orc::MapperJITLinkMemoryManager::CreateWithMapper()); #else return cantFail(orc::MapperJITLinkMemoryManager::CreateWithMapper(/*Reservation Granularity*/ 16 * 1024 * 1024)); diff --git a/src/jitlayers.h b/src/jitlayers.h index d0de6829804df..3da4c28af6601 100644 --- a/src/jitlayers.h +++ b/src/jitlayers.h @@ -53,16 +53,8 @@ #endif // The sanitizers don't play well with our memory manager -#if defined(JL_FORCE_JITLINK) || JL_LLVM_VERSION >= 150000 && defined(HAS_SANITIZER) +#if defined(JL_FORCE_JITLINK) || defined(_CPU_AARCH64_) || defined(HAS_SANITIZER) # define JL_USE_JITLINK -#else -# if defined(_CPU_AARCH64_) -# if defined(_OS_LINUX_) && JL_LLVM_VERSION < 150000 -# pragma message("On aarch64-gnu-linux, LLVM version >= 15 is required for JITLink; fallback suffers from occasional segfaults") -# else -# define JL_USE_JITLINK -# endif -# endif #endif # include diff --git a/src/pipeline.cpp b/src/pipeline.cpp index 81f68df0c8870..aafce01856634 100644 --- a/src/pipeline.cpp +++ b/src/pipeline.cpp @@ -215,9 +215,6 @@ namespace { // .sinkCommonInsts(true) ; } -#if JL_LLVM_VERSION < 150000 -#define LICMOptions() -#endif // At any given time exactly one of each pair of overloads is strictly unused #ifdef _COMPILER_GCC_