diff --git a/src/aotcompile.cpp b/src/aotcompile.cpp index 4fc9ad4bdf596..cf6378b4f926b 100644 --- a/src/aotcompile.cpp +++ b/src/aotcompile.cpp @@ -9,11 +9,7 @@ #include #include #include -#if JL_LLVM_VERSION >= 140000 #include -#else -#include -#endif #include // analysis passes diff --git a/src/ccall.cpp b/src/ccall.cpp index 6b2143579317f..90f7417c03524 100644 --- a/src/ccall.cpp +++ b/src/ccall.cpp @@ -958,10 +958,8 @@ static jl_cgval_t emit_llvmcall(jl_codectx_t &ctx, jl_value_t **args, size_t nar // copy module properties that should always match Mod->setTargetTriple(jl_Module->getTargetTriple()); Mod->setDataLayout(jl_Module->getDataLayout()); -#if JL_LLVM_VERSION >= 130000 Mod->setStackProtectorGuard(jl_Module->getStackProtectorGuard()); Mod->setOverrideStackAlignment(jl_Module->getOverrideStackAlignment()); -#endif // verify the definition Function *def = Mod->getFunction(ir_name); @@ -1097,11 +1095,7 @@ std::string generate_func_sig(const char *fname) abi->use_sret(jl_voidpointer_type, LLVMCtx); } else if (abi->use_sret((jl_datatype_t*)rt, LLVMCtx)) { -#if JL_LLVM_VERSION >= 140000 AttrBuilder retattrs(LLVMCtx); -#else - AttrBuilder retattrs; -#endif if (!ctx->TargetTriple.isOSWindows()) { // llvm used to use the old mingw ABI, skipping this marking works around that difference retattrs.addStructRetAttr(lrt); @@ -1120,11 +1114,7 @@ std::string generate_func_sig(const char *fname) } for (size_t i = 0; i < nccallargs; ++i) { -#if JL_LLVM_VERSION >= 140000 AttrBuilder ab(LLVMCtx); -#else - AttrBuilder ab; -#endif jl_value_t *tti = jl_svecref(at, i); Type *t = NULL; bool isboxed; diff --git a/src/cgutils.cpp b/src/cgutils.cpp index 46c7407e95d98..9e42a6b246e9b 100644 --- a/src/cgutils.cpp +++ b/src/cgutils.cpp @@ -1768,12 +1768,8 @@ std::vector first_ptr(Type *T) num_elements = AT->getNumElements(); else { VectorType *VT = cast(T); -#if JL_LLVM_VERSION >= 120000 ElementCount EC = VT->getElementCount(); num_elements = EC.getKnownMinValue(); -#else - num_elements = VT->getNumElements(); -#endif } if (num_elements == 0) return {}; @@ -2015,12 +2011,7 @@ static jl_cgval_t typed_store(jl_codectx_t &ctx, assert(Order != AtomicOrdering::NotAtomic && r); // we can't handle isboxed here as a workaround for really bad LLVM // design issue: plain Xchg only works with integers -#if JL_LLVM_VERSION >= 130000 auto *store = ctx.builder.CreateAtomicRMW(AtomicRMWInst::Xchg, ptr, r, Align(alignment), Order); -#else - auto *store = ctx.builder.CreateAtomicRMW(AtomicRMWInst::Xchg, ptr, r, Order); - store->setAlignment(Align(alignment)); -#endif jl_aliasinfo_t ai = jl_aliasinfo_t::fromTBAA(ctx, tbaa); ai.noalias = MDNode::concatenate(aliasscope, ai.noalias); ai.decorateInst(store); @@ -2170,12 +2161,7 @@ static jl_cgval_t typed_store(jl_codectx_t &ctx, FailOrder = AtomicOrdering::Monotonic; else if (FailOrder == AtomicOrdering::Unordered) FailOrder = AtomicOrdering::Monotonic; -#if JL_LLVM_VERSION >= 130000 auto *store = ctx.builder.CreateAtomicCmpXchg(ptr, Compare, r, Align(alignment), Order, FailOrder); -#else - auto *store = ctx.builder.CreateAtomicCmpXchg(ptr, Compare, r, Order, FailOrder); - store->setAlignment(Align(alignment)); -#endif jl_aliasinfo_t ai = jl_aliasinfo_t::fromTBAA(ctx, tbaa); ai.noalias = MDNode::concatenate(aliasscope, ai.noalias); ai.decorateInst(store); @@ -3052,12 +3038,8 @@ static jl_value_t *static_constant_instance(const llvm::DataLayout &DL, Constant if (const auto *CC = dyn_cast(constant)) nargs = CC->getNumOperands(); else if (const auto *CAZ = dyn_cast(constant)) { -#if JL_LLVM_VERSION >= 130000 // SVE: Elsewhere we use `getMinKownValue` nargs = CAZ->getElementCount().getFixedValue(); -#else - nargs = CAZ->getNumElements(); -#endif } else if (const auto *CDS = dyn_cast(constant)) nargs = CDS->getNumElements(); diff --git a/src/codegen.cpp b/src/codegen.cpp index 10ee78ef6e8e1..a5d54f16ed2e6 100644 --- a/src/codegen.cpp +++ b/src/codegen.cpp @@ -20,11 +20,7 @@ // target machine computation #include -#if JL_LLVM_VERSION >= 140000 #include -#else -#include -#endif #include #include #include @@ -2338,7 +2334,7 @@ std::unique_ptr jl_create_llvm_module(StringRef name, LLVMContext &conte m->setOverrideStackAlignment(16); } -#if defined(JL_DEBUG_BUILD) && JL_LLVM_VERSION >= 130000 +#if defined(JL_DEBUG_BUILD) m->setStackProtectorGuard("global"); #endif return m; @@ -2347,11 +2343,7 @@ std::unique_ptr jl_create_llvm_module(StringRef name, LLVMContext &conte static void jl_init_function(Function *F, const Triple &TT) { // set any attributes that *must* be set on all functions -#if JL_LLVM_VERSION >= 140000 AttrBuilder attr(F->getContext()); -#else - AttrBuilder attr; -#endif if (TT.isOSWindows() && TT.getArch() == Triple::x86) { // tell Win32 to assume the stack is always 16-byte aligned, // and to ensure that it is 16-byte aligned for out-going calls, @@ -2383,11 +2375,7 @@ static void jl_init_function(Function *F, const Triple &TT) #if defined(_COMPILER_MSAN_ENABLED_) attr.addAttribute(Attribute::SanitizeMemory); #endif -#if JL_LLVM_VERSION >= 140000 F->addFnAttrs(attr); -#else - F->addAttributes(AttributeList::FunctionIndex, attr); -#endif } static bool uses_specsig(jl_value_t *sig, bool needsparams, bool va, jl_value_t *rettype, bool prefer_specsig) @@ -5978,13 +5966,8 @@ static Function* gen_cfun_wrapper( // we are adding the extra nest parameter after sret arg. std::vector> newAttributes; newAttributes.reserve(attributes.getNumAttrSets() + 1); -#if JL_LLVM_VERSION >= 140000 auto it = *attributes.indexes().begin(); const auto it_end = *attributes.indexes().end(); -#else - auto it = attributes.index_begin(); - const auto it_end = attributes.index_end(); -#endif // Skip past FunctionIndex if (it == AttributeList::AttrIndex::FunctionIndex) { @@ -5999,11 +5982,7 @@ static Function* gen_cfun_wrapper( } // Add the new nest attribute -#if JL_LLVM_VERSION >= 140000 AttrBuilder attrBuilder(M->getContext()); -#else - AttrBuilder attrBuilder; -#endif attrBuilder.addAttribute(Attribute::Nest); newAttributes.emplace_back(it, AttributeSet::get(M->getContext(), attrBuilder)); @@ -6868,11 +6847,7 @@ static jl_returninfo_t get_specsig_function(jl_codectx_t &ctx, Module *M, Value SmallVector attrs; // function declaration attributes if (props.cc == jl_returninfo_t::SRet) { assert(srt); -#if JL_LLVM_VERSION >= 140000 AttrBuilder param(ctx.builder.getContext()); -#else - AttrBuilder param; -#endif param.addStructRetAttr(srt); param.addAttribute(Attribute::NoAlias); param.addAttribute(Attribute::NoCapture); @@ -6881,11 +6856,7 @@ static jl_returninfo_t get_specsig_function(jl_codectx_t &ctx, Module *M, Value assert(fsig.size() == 1); } if (props.cc == jl_returninfo_t::Union) { -#if JL_LLVM_VERSION >= 140000 AttrBuilder param(ctx.builder.getContext()); -#else - AttrBuilder param; -#endif param.addAttribute(Attribute::NoAlias); param.addAttribute(Attribute::NoCapture); param.addAttribute(Attribute::NoUndef); @@ -6894,11 +6865,7 @@ static jl_returninfo_t get_specsig_function(jl_codectx_t &ctx, Module *M, Value } if (props.return_roots) { -#if JL_LLVM_VERSION >= 140000 AttrBuilder param(ctx.builder.getContext()); -#else - AttrBuilder param; -#endif param.addAttribute(Attribute::NoAlias); param.addAttribute(Attribute::NoCapture); param.addAttribute(Attribute::NoUndef); @@ -6922,11 +6889,7 @@ static jl_returninfo_t get_specsig_function(jl_codectx_t &ctx, Module *M, Value } if (type_is_ghost(ty)) continue; -#if JL_LLVM_VERSION >= 140000 AttrBuilder param(ctx.builder.getContext()); -#else - AttrBuilder param; -#endif if (ty->isAggregateType()) { // aggregate types are passed by pointer param.addAttribute(Attribute::NoCapture); param.addAttribute(Attribute::ReadOnly); @@ -7245,16 +7208,8 @@ static jl_llvm_functions_t declarations.functionObject = needsparams ? "jl_fptr_sparam" : "jl_fptr_args"; } -#if JL_LLVM_VERSION >= 140000 AttrBuilder FnAttrs(ctx.builder.getContext(), f->getAttributes().getFnAttrs()); -#else - AttrBuilder FnAttrs(f->getAttributes().getFnAttributes()); -#endif -#if JL_LLVM_VERSION >= 140000 AttrBuilder RetAttrs(ctx.builder.getContext(), f->getAttributes().getRetAttrs()); -#else - AttrBuilder RetAttrs(f->getAttributes().getRetAttributes()); -#endif if (jlrettype == (jl_value_t*)jl_bottom_type) FnAttrs.addAttribute(Attribute::NoReturn); @@ -7547,11 +7502,7 @@ static jl_llvm_functions_t } Argument *Arg = &*AI; ++AI; -#if JL_LLVM_VERSION >= 140000 AttrBuilder param(ctx.builder.getContext(), f->getAttributes().getParamAttrs(Arg->getArgNo())); -#else - AttrBuilder param(f->getAttributes().getParamAttributes(Arg->getArgNo())); -#endif jl_cgval_t theArg; if (llvmArgType->isAggregateType()) { maybe_mark_argument_dereferenceable(param, argType); @@ -7571,11 +7522,7 @@ static jl_llvm_functions_t if (has_sret) { Argument *Arg = &*AI; ++AI; -#if JL_LLVM_VERSION >= 140000 AttrBuilder param(ctx.builder.getContext(), f->getAttributes().getParamAttrs(Arg->getArgNo())); -#else - AttrBuilder param(f->getAttributes().getParamAttributes(Arg->getArgNo())); -#endif if (returninfo.cc == jl_returninfo_t::Union) { param.addAttribute(Attribute::NonNull); // The `dereferenceable` below does not imply `nonnull` for non addrspace(0) pointers. @@ -7597,11 +7544,7 @@ static jl_llvm_functions_t if (returninfo.return_roots) { Argument *Arg = &*AI; ++AI; -#if JL_LLVM_VERSION >= 140000 AttrBuilder param(ctx.builder.getContext(), f->getAttributes().getParamAttrs(Arg->getArgNo())); -#else - AttrBuilder param(f->getAttributes().getParamAttributes(Arg->getArgNo())); -#endif param.addAttribute(Attribute::NonNull); // The `dereferenceable` below does not imply `nonnull` for non addrspace(0) pointers. size_t size = returninfo.return_roots * sizeof(jl_value_t*); diff --git a/src/disasm.cpp b/src/disasm.cpp index 8e0516d5e5431..96595d4381987 100644 --- a/src/disasm.cpp +++ b/src/disasm.cpp @@ -92,11 +92,7 @@ #include #include #include -#if JL_LLVM_VERSION >= 140000 #include -#else -#include -#endif #include #include @@ -883,16 +879,10 @@ static void jl_dump_asm_internal( TheTarget->createMCSubtargetInfo(TheTriple.str(), cpu, features)); assert(STI && "Unable to create subtarget info!"); -#if JL_LLVM_VERSION >= 130000 MCContext Ctx(TheTriple, MAI.get(), MRI.get(), STI.get(), &SrcMgr); std::unique_ptr MOFI( TheTarget->createMCObjectFileInfo(Ctx, /*PIC=*/false, /*LargeCodeModel=*/ false)); Ctx.setObjectFileInfo(MOFI.get()); -#else - std::unique_ptr MOFI(new MCObjectFileInfo()); - MCContext Ctx(MAI.get(), MRI.get(), MOFI.get(), &SrcMgr); - MOFI->InitMCObjectFileInfo(TheTriple, /* PIC */ false, Ctx); -#endif std::unique_ptr DisAsm(TheTarget->createMCDisassembler(*STI, Ctx)); if (!DisAsm) { diff --git a/src/jitlayers.cpp b/src/jitlayers.cpp index c16f9cfbb8121..30dbb0b939f02 100644 --- a/src/jitlayers.cpp +++ b/src/jitlayers.cpp @@ -12,9 +12,7 @@ #include #include #include -#if JL_LLVM_VERSION >= 130000 #include -#endif #include #include #include @@ -26,11 +24,7 @@ // target machine computation #include -#if JL_LLVM_VERSION >= 140000 #include -#else -#include -#endif #include #include #include @@ -44,9 +38,7 @@ using namespace llvm; #include "processor.h" #ifdef JL_USE_JITLINK -# if JL_LLVM_VERSION >= 140000 -# include -# endif +# include # include # include # if JL_LLVM_VERSION >= 150000 @@ -820,11 +812,7 @@ class JLDebuginfoPlugin : public ObjectLinkingLayer::Plugin { auto SecName = Sec.getName(); #endif // https://github.com/llvm/llvm-project/commit/118e953b18ff07d00b8f822dfbf2991e41d6d791 -#if JL_LLVM_VERSION >= 140000 Info.SectionLoadAddresses[SecName] = jitlink::SectionRange(Sec).getStart().getValue(); -#else - Info.SectionLoadAddresses[SecName] = jitlink::SectionRange(Sec).getStart(); -#endif } return Error::success(); }); @@ -866,9 +854,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 < 140000 - return std::make_unique(); -#elif JL_LLVM_VERSION < 150000 +#if JL_LLVM_VERSION < 150000 return cantFail(jitlink::InProcessMemoryManager::Create()); #else return cantFail(orc::MapperJITLinkMemoryManager::CreateWithMapper()); @@ -878,17 +864,11 @@ std::unique_ptr createJITLinkMemoryManager() { # ifdef LLVM_SHLIB -# if JL_LLVM_VERSION >= 140000 -# define EHFRAME_RANGE(name) orc::ExecutorAddrRange name -# define UNPACK_EHFRAME_RANGE(name) \ +# define EHFRAME_RANGE(name) orc::ExecutorAddrRange name +# define UNPACK_EHFRAME_RANGE(name) \ name.Start.toPtr(), \ static_cast(name.size()) -# else -# define EHFRAME_RANGE(name) JITTargetAddress name##Addr, size_t name##Size -# define UNPACK_EHFRAME_RANGE(name) \ - jitTargetAddressToPointer(name##Addr), \ - name##Size -# endif + class JLEHFrameRegistrar final : public jitlink::EHFrameRegistrar { public: @@ -1022,19 +1002,6 @@ namespace { TheTriple.setObjectFormat(Triple::ELF); } //options.PrintMachineCode = true; //Print machine code produced during JIT compiling -#if JL_LLVM_VERSION < 130000 - if (TheTriple.isOSWindows() && TheTriple.getArch() == Triple::x86) { - // tell Win32 to assume the stack is always 16-byte aligned, - // and to ensure that it is 16-byte aligned for out-going calls, - // to ensure compatibility with GCC codes - // In LLVM 13 and onwards this has turned into a module option - options.StackAlignmentOverride = 16; - } -#endif -#if defined(JL_DEBUG_BUILD) && JL_LLVM_VERSION < 130000 - // LLVM defaults to tls stack guard, which causes issues with Julia's tls implementation - options.StackProtectorGuard = StackProtectorGuards::Global; -#endif #if defined(MSAN_EMUTLS_WORKAROUND) options.EmulatedTLS = true; options.ExplicitEmulatedTLS = true; @@ -1300,11 +1267,7 @@ int64_t ___asan_globals_registered; JuliaOJIT::JuliaOJIT() : TM(createTargetMachine()), DL(jl_create_datalayout(*TM)), -#if JL_LLVM_VERSION >= 130000 ES(cantFail(orc::SelfExecutorProcessControl::Create())), -#else - ES(), -#endif GlobalJD(ES.createBareJITDylib("JuliaGlobals")), JD(ES.createBareJITDylib("JuliaOJIT")), ContextPool([](){ @@ -1568,10 +1531,6 @@ StringRef JuliaOJIT::getFunctionAtAddress(uint64_t Addr, jl_code_instance_t *cod #ifdef JL_USE_JITLINK -# if JL_LLVM_VERSION < 140000 -# pragma message("JIT debugging (GDB integration) not available on LLVM < 14.0 (for JITLink)") -void JuliaOJIT::enableJITDebuggingSupport() {} -# else extern "C" orc::shared::CWrapperFunctionResult llvm_orc_registerJITLoaderGDBAllocAction(const char *Data, size_t Size); @@ -1585,7 +1544,6 @@ void JuliaOJIT::enableJITDebuggingSupport() const auto Addr = ExecutorAddr::fromPtr(&llvm_orc_registerJITLoaderGDBAllocAction); ObjectLayer.addPlugin(std::make_unique(Addr)); } -# endif #else void JuliaOJIT::enableJITDebuggingSupport() { diff --git a/src/jitlayers.h b/src/jitlayers.h index 4c6921cd42dab..c056a6b3418a3 100644 --- a/src/jitlayers.h +++ b/src/jitlayers.h @@ -50,9 +50,6 @@ // The sanitizers don't play well with our memory manager #if defined(_OS_DARWIN_) && defined(_CPU_AARCH64_) || defined(JL_FORCE_JITLINK) || JL_LLVM_VERSION >= 150000 && defined(HAS_SANITIZER) -# if JL_LLVM_VERSION < 130000 -# pragma message("On aarch64-darwin, LLVM version >= 13 is required for JITLink; fallback suffers from occasional segfaults") -# endif # define JL_USE_JITLINK #endif diff --git a/src/llvm-codegen-shared.h b/src/llvm-codegen-shared.h index 1d4414d6aaaa8..0ab140b42b8b7 100644 --- a/src/llvm-codegen-shared.h +++ b/src/llvm-codegen-shared.h @@ -316,125 +316,73 @@ using namespace llvm; inline void addFnAttr(CallInst *Target, Attribute::AttrKind Attr) { -#if JL_LLVM_VERSION >= 140000 Target->addFnAttr(Attr); -#else - Target->addAttribute(AttributeList::FunctionIndex, Attr); -#endif } template inline void addRetAttr(T *Target, A Attr) { -#if JL_LLVM_VERSION >= 140000 Target->addRetAttr(Attr); -#else - Target->addAttribute(AttributeList::ReturnIndex, Attr); -#endif } inline void addAttributeAtIndex(Function *F, unsigned Index, Attribute Attr) { -#if JL_LLVM_VERSION >= 140000 F->addAttributeAtIndex(Index, Attr); -#else - F->addAttribute(Index, Attr); -#endif } inline AttributeSet getFnAttrs(const AttributeList &Attrs) { -#if JL_LLVM_VERSION >= 140000 return Attrs.getFnAttrs(); -#else - return Attrs.getFnAttributes(); -#endif } inline AttributeSet getRetAttrs(const AttributeList &Attrs) { -#if JL_LLVM_VERSION >= 140000 return Attrs.getRetAttrs(); -#else - return Attrs.getRetAttributes(); -#endif } inline bool hasFnAttr(const AttributeList &L, Attribute::AttrKind Kind) { -#if JL_LLVM_VERSION >= 140000 return L.hasFnAttr(Kind); -#else - return L.hasAttribute(AttributeList::FunctionIndex, Kind); -#endif } inline AttributeList addAttributeAtIndex(const AttributeList &L, LLVMContext &C, unsigned Index, Attribute::AttrKind Kind) { -#if JL_LLVM_VERSION >= 140000 return L.addAttributeAtIndex(C, Index, Kind); -#else - return L.addAttribute(C, Index, Kind); -#endif } inline AttributeList addAttributeAtIndex(const AttributeList &L, LLVMContext &C, unsigned Index, Attribute Attr) { -#if JL_LLVM_VERSION >= 140000 return L.addAttributeAtIndex(C, Index, Attr); -#else - return L.addAttribute(C, Index, Attr); -#endif } inline AttributeList addAttributesAtIndex(const AttributeList &L, LLVMContext &C, unsigned Index, const AttrBuilder &Builder) { -#if JL_LLVM_VERSION >= 140000 return L.addAttributesAtIndex(C, Index, Builder); -#else - return L.addAttributes(C, Index, Builder); -#endif } inline AttributeList addFnAttribute(const AttributeList &L, LLVMContext &C, Attribute::AttrKind Kind) { -#if JL_LLVM_VERSION >= 140000 return L.addFnAttribute(C, Kind); -#else - return L.addAttribute(C, AttributeList::FunctionIndex, Kind); -#endif } inline AttributeList addRetAttribute(const AttributeList &L, LLVMContext &C, Attribute::AttrKind Kind) { -#if JL_LLVM_VERSION >= 140000 return L.addRetAttribute(C, Kind); -#else - return L.addAttribute(C, AttributeList::ReturnIndex, Kind); -#endif } inline bool hasAttributesAtIndex(const AttributeList &L, unsigned Index) { -#if JL_LLVM_VERSION >= 140000 return L.hasAttributesAtIndex(Index); -#else - return L.hasAttributes(Index); -#endif } inline Attribute getAttributeAtIndex(const AttributeList &L, unsigned Index, Attribute::AttrKind Kind) { -#if JL_LLVM_VERSION >= 140000 return L.getAttributeAtIndex(Index, Kind); -#else - return L.getAttribute(Index, Kind); -#endif } // Iterate through uses of a particular type. diff --git a/src/llvm-multiversioning.cpp b/src/llvm-multiversioning.cpp index da381c17be5e1..814b13554358c 100644 --- a/src/llvm-multiversioning.cpp +++ b/src/llvm-multiversioning.cpp @@ -546,12 +546,8 @@ static void clone_function(Function *F, Function *new_f, ValueToValueMapTy &vmap vmap[&*J] = &*DestI++; } SmallVector Returns; -#if JL_LLVM_VERSION >= 130000 // We are cloning into the same module CloneFunctionInto(new_f, F, vmap, CloneFunctionChangeType::GlobalChanges, Returns); -#else - CloneFunctionInto(new_f, F, vmap, true, Returns); -#endif } static void add_features(Function *F, TargetSpec &spec) diff --git a/src/llvm-remove-addrspaces.cpp b/src/llvm-remove-addrspaces.cpp index 650c457ad4a7c..b964c20e3353e 100644 --- a/src/llvm-remove-addrspaces.cpp +++ b/src/llvm-remove-addrspaces.cpp @@ -343,11 +343,7 @@ bool removeAddrspaces(Module &M, AddrspaceRemapFunction ASRemapper) for (auto MD : MDs) NGV->addMetadata( MD.first, -#if JL_LLVM_VERSION >= 130000 *MapMetadata(MD.second, VMap)); -#else - *MapMetadata(MD.second, VMap, RF_MoveDistinctMDs)); -#endif copyComdat(NGV, GV); @@ -372,11 +368,7 @@ bool removeAddrspaces(Module &M, AddrspaceRemapFunction ASRemapper) NF, F, VMap, -#if JL_LLVM_VERSION >= 130000 CloneFunctionChangeType::GlobalChanges, -#else - /*ModuleLevelChanges=*/true, -#endif Returns, "", nullptr, @@ -389,19 +381,10 @@ bool removeAddrspaces(Module &M, AddrspaceRemapFunction ASRemapper) for (unsigned i = 0; i < Attrs.getNumAttrSets(); ++i) { for (Attribute::AttrKind TypedAttr : {Attribute::ByVal, Attribute::StructRet, Attribute::ByRef}) { -#if JL_LLVM_VERSION >= 140000 auto Attr = Attrs.getAttributeAtIndex(i, TypedAttr); -#else - auto Attr = Attrs.getAttribute(i, TypedAttr); -#endif if (Type *Ty = Attr.getValueAsType()) { -#if JL_LLVM_VERSION >= 140000 Attrs = Attrs.replaceAttributeTypeAtIndex( C, i, TypedAttr, TypeRemapper.remapType(Ty)); -#else - Attrs = Attrs.replaceAttributeType( - C, i, TypedAttr, TypeRemapper.remapType(Ty)); -#endif break; } } diff --git a/src/llvm-version.h b/src/llvm-version.h index 819ec1c88976b..01638b8d44a6e 100644 --- a/src/llvm-version.h +++ b/src/llvm-version.h @@ -10,8 +10,8 @@ #define JL_LLVM_VERSION (LLVM_VERSION_MAJOR * 10000 + LLVM_VERSION_MINOR * 100 \ + LLVM_VERSION_PATCH) -#if JL_LLVM_VERSION < 120000 - #error Only LLVM versions >= 12.0.0 are supported by Julia +#if JL_LLVM_VERSION < 140000 + #error Only LLVM versions >= 14.0.0 are supported by Julia #endif #if JL_LLVM_VERSION >= 160000