Skip to content

Commit 602b46c

Browse files
authored
[LLVM] Drop support for LLVM 11 (#43371)
1 parent 4b0d6c9 commit 602b46c

11 files changed

+3
-120
lines changed

src/abi_ppc64le.cpp

-4
Original file line numberDiff line numberDiff line change
@@ -106,11 +106,7 @@ bool needPassByRef(jl_datatype_t *dt, AttrBuilder &ab, LLVMContext &ctx, Type *T
106106
jl_datatype_t *ty0 = NULL;
107107
bool hva = false;
108108
if (jl_datatype_size(dt) > 64 && isHFA(dt, &ty0, &hva) > 8) {
109-
#if JL_LLVM_VERSION < 120000
110-
ab.addAttribute(Attribute::ByVal);
111-
#else
112109
ab.addByValAttr(Ty);
113-
#endif
114110
return true;
115111
}
116112
return false;

src/abi_win32.cpp

-4
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,7 @@ bool needPassByRef(jl_datatype_t *dt, AttrBuilder &ab, LLVMContext &ctx, Type *T
5353
{
5454
// Use pass by reference for all structs
5555
if (dt->layout->nfields > 0) {
56-
#if JL_LLVM_VERSION < 120000
57-
ab.addAttribute(Attribute::ByVal);
58-
#else
5956
ab.addByValAttr(Ty);
60-
#endif
6157
return true;
6258
}
6359
return false;

src/abi_win64.cpp

-4
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,7 @@ bool needPassByRef(jl_datatype_t *dt, AttrBuilder &ab, LLVMContext &ctx, Type *T
6363
if (win64_reg_size(size))
6464
return false;
6565
if (nargs <= 4) {
66-
#if JL_LLVM_VERSION < 120000
67-
ab.addAttribute(Attribute::ByVal);
68-
#else
6966
ab.addByValAttr(Ty);
70-
#endif
7167
}
7268
return true;
7369
}

src/abi_x86.cpp

-4
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,7 @@ bool needPassByRef(jl_datatype_t *dt, AttrBuilder &ab, LLVMContext &ctx, Type *T
7272
size_t size = jl_datatype_size(dt);
7373
if (is_complex64(dt) || is_complex128(dt) || (jl_is_primitivetype(dt) && size <= 8))
7474
return false;
75-
#if JL_LLVM_VERSION < 120000
76-
ab.addAttribute(Attribute::ByVal);
77-
#else
7875
ab.addByValAttr(Ty);
79-
#endif
8076
return true;
8177
}
8278

src/abi_x86_64.cpp

-8
Original file line numberDiff line numberDiff line change
@@ -182,11 +182,7 @@ bool needPassByRef(jl_datatype_t *dt, AttrBuilder &ab, LLVMContext &ctx, Type *T
182182
{
183183
Classification cl = classify(dt);
184184
if (cl.isMemory) {
185-
#if JL_LLVM_VERSION < 120000
186-
ab.addAttribute(Attribute::ByVal);
187-
#else
188185
ab.addByValAttr(Ty);
189-
#endif
190186
return true;
191187
}
192188

@@ -206,12 +202,8 @@ bool needPassByRef(jl_datatype_t *dt, AttrBuilder &ab, LLVMContext &ctx, Type *T
206202
else if (jl_is_structtype(dt)) {
207203
// spill to memory even though we would ordinarily pass
208204
// it in registers
209-
#if JL_LLVM_VERSION < 120000
210-
ab.addAttribute(Attribute::ByVal);
211-
#else
212205
Type* Ty = preferred_llvm_type(dt, false, ctx);
213206
ab.addByValAttr(Ty);
214-
#endif
215207
return true;
216208
}
217209
return false;

src/ccall.cpp

-4
Original file line numberDiff line numberDiff line change
@@ -1031,11 +1031,7 @@ std::string generate_func_sig(const char *fname)
10311031
else if (abi->use_sret((jl_datatype_t*)rt, jl_LLVMContext)) {
10321032
AttrBuilder retattrs = AttrBuilder();
10331033
#if !defined(_OS_WINDOWS_) // llvm used to use the old mingw ABI, skipping this marking works around that difference
1034-
#if JL_LLVM_VERSION < 120000
1035-
retattrs.addAttribute(Attribute::StructRet);
1036-
#else
10371034
retattrs.addStructRetAttr(lrt);
1038-
#endif
10391035
#endif
10401036
retattrs.addAttribute(Attribute::NoAlias);
10411037
paramattrs.push_back(std::move(retattrs));

src/codegen.cpp

-6
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,7 @@
7070
// for configuration options
7171
#include <llvm/Support/PrettyStackTrace.h>
7272
#include <llvm/Support/CommandLine.h>
73-
#if JL_LLVM_VERSION >= 120000
7473
#include <llvm/Support/Process.h>
75-
#endif
7674

7775
#include <llvm/IR/InlineAsm.h>
7876
#if defined(_CPU_ARM_) || defined(_CPU_AARCH64_)
@@ -8088,11 +8086,7 @@ extern "C" void jl_init_llvm(void)
80888086
// This is the only way I can find to print the help message once.
80898087
// It'll be nice if we can iterate through the features and print our own help
80908088
// message...
8091-
#if JL_LLVM_VERSION >= 120000
80928089
MSTI->setDefaultFeatures("help", "", "");
8093-
#else
8094-
MSTI->setDefaultFeatures("help", "");
8095-
#endif
80968090
}
80978091
}
80988092
// Package up features to be passed to target/subtarget

src/jitlayers.cpp

-46
Original file line numberDiff line numberDiff line change
@@ -481,22 +481,12 @@ JL_DLLEXPORT void ORCNotifyObjectEmitted(JITEventListener *Listener,
481481
const RuntimeDyld::LoadedObjectInfo &L,
482482
RTDyldMemoryManager *memmgr);
483483

484-
#if JL_LLVM_VERSION >= 120000
485484
template <typename ObjT, typename LoadResult>
486485
void JuliaOJIT::registerObject(const ObjT &Obj, const LoadResult &LO)
487486
{
488487
const ObjT* Object = &Obj;
489488
ORCNotifyObjectEmitted(JuliaListener.get(), *Object, *LO, MemMgr.get());
490489
}
491-
#else
492-
template <typename ObjT, typename LoadResult>
493-
void JuliaOJIT::registerObject(RTDyldObjHandleT H, const ObjT &Obj, const LoadResult &LO)
494-
{
495-
const ObjT* Object = &Obj;
496-
NotifyFinalizer(H, *Object, *LO);
497-
ORCNotifyObjectEmitted(JuliaListener.get(), *Object, *LO, MemMgr.get());
498-
}
499-
#endif
500490

501491
CodeGenOpt::Level CodeGenOptLevelFor(int optlevel)
502492
{
@@ -636,21 +626,12 @@ JuliaOJIT::JuliaOJIT(TargetMachine &TM, LLVMContext *LLVMCtx)
636626
),
637627
CompileLayer(ES, ObjectLayer, std::make_unique<CompilerT>(this))
638628
{
639-
#if JL_LLVM_VERSION >= 120000
640629
ObjectLayer.setNotifyLoaded(
641630
[this](orc::MaterializationResponsibility &MR,
642631
const object::ObjectFile &Object,
643632
const RuntimeDyld::LoadedObjectInfo &LOS) {
644633
registerObject(Object, &LOS);
645634
});
646-
#else
647-
ObjectLayer.setNotifyLoaded(
648-
[this](RTDyldObjHandleT H,
649-
const object::ObjectFile &Object,
650-
const RuntimeDyld::LoadedObjectInfo &LOS) {
651-
registerObject(H, Object, &LOS);
652-
});
653-
#endif
654635
for (int i = 0; i < 4; i++) {
655636
TMs[i] = TM.getTarget().createTargetMachine(TM.getTargetTriple().getTriple(), TM.getTargetCPU(),
656637
TM.getTargetFeatureString(), TM.Options, Reloc::Static, TM.getCodeModel(),
@@ -734,28 +715,15 @@ void JuliaOJIT::addModule(std::unique_ptr<Module> M)
734715
}
735716
}
736717
#endif
737-
#if JL_LLVM_VERSION >= 120000
738718
// TODO: what is the performance characteristics of this?
739719
cantFail(CompileLayer.add(JD, orc::ThreadSafeModule(std::move(M), TSCtx)));
740-
#else
741-
auto key = ES.allocateVModule();
742-
// TODO: what is the performance characteristics of this?
743-
cantFail(CompileLayer.add(JD, orc::ThreadSafeModule(std::move(M), TSCtx), key));
744-
#endif
745720
// force eager compilation (for now), due to memory management specifics
746721
// (can't handle compilation recursion)
747722
for (auto Name : NewExports)
748723
cantFail(ES.lookup({&JD}, Name));
749724

750725
}
751726

752-
#if JL_LLVM_VERSION < 120000
753-
void JuliaOJIT::removeModule(ModuleHandleT H)
754-
{
755-
//(void)CompileLayer.remove(H);
756-
}
757-
#endif
758-
759727
JL_JITSymbol JuliaOJIT::findSymbol(StringRef Name, bool ExportedSymbolsOnly)
760728
{
761729
orc::JITDylib* SearchOrders[2] = {&GlobalJD, &JD};
@@ -825,22 +793,8 @@ void JuliaOJIT::RegisterJITEventListener(JITEventListener *L)
825793
{
826794
if (!L)
827795
return;
828-
#if JL_LLVM_VERSION >= 120000
829796
this->ObjectLayer.registerJITEventListener(*L);
830-
#else
831-
EventListeners.push_back(L);
832-
#endif
833-
}
834-
835-
#if JL_LLVM_VERSION < 120000
836-
void JuliaOJIT::NotifyFinalizer(RTDyldObjHandleT Key,
837-
const object::ObjectFile &Obj,
838-
const RuntimeDyld::LoadedObjectInfo &LoadedObjectInfo)
839-
{
840-
for (auto &Listener : EventListeners)
841-
Listener->notifyObjectLoaded(Key, Obj, LoadedObjectInfo);
842797
}
843-
#endif
844798

845799
const DataLayout& JuliaOJIT::getDataLayout() const
846800
{

src/jitlayers.h

+1-22
Original file line numberDiff line numberDiff line change
@@ -143,10 +143,6 @@ typedef JITSymbol JL_JITSymbol;
143143
// is expected.
144144
typedef JITSymbol JL_SymbolInfo;
145145

146-
#if JL_LLVM_VERSION < 120000
147-
using RTDyldObjHandleT = orc::VModuleKey;
148-
#endif
149-
150146
using CompilerResultT = Expected<std::unique_ptr<llvm::MemoryBuffer>>;
151147

152148
class JuliaOJIT {
@@ -158,38 +154,21 @@ class JuliaOJIT {
158154
private:
159155
JuliaOJIT &jit;
160156
};
161-
#if JL_LLVM_VERSION >= 120000
162157
// Custom object emission notification handler for the JuliaOJIT
163158
template <typename ObjT, typename LoadResult>
164159
void registerObject(const ObjT &Obj, const LoadResult &LO);
165-
#else
166-
// Custom object emission notification handler for the JuliaOJIT
167-
template <typename ObjT, typename LoadResult>
168-
void registerObject(RTDyldObjHandleT H, const ObjT &Obj, const LoadResult &LO);
169-
#endif
170160

171161
public:
172162
typedef orc::RTDyldObjectLinkingLayer ObjLayerT;
173163
typedef orc::IRCompileLayer CompileLayerT;
174-
#if JL_LLVM_VERSION < 120000
175-
typedef RTDyldObjHandleT ModuleHandleT;
176-
#endif
177164
typedef object::OwningBinary<object::ObjectFile> OwningObj;
178165

179166
JuliaOJIT(TargetMachine &TM, LLVMContext *Ctx);
180167

181168
void RegisterJITEventListener(JITEventListener *L);
182-
#if JL_LLVM_VERSION < 120000
183-
std::vector<JITEventListener *> EventListeners;
184-
void NotifyFinalizer(RTDyldObjHandleT Key,
185-
const object::ObjectFile &Obj,
186-
const RuntimeDyld::LoadedObjectInfo &LoadedObjectInfo);
187-
#endif
188169
void addGlobalMapping(StringRef Name, uint64_t Addr);
189170
void addModule(std::unique_ptr<Module> M);
190-
#if JL_LLVM_VERSION < 120000
191-
void removeModule(ModuleHandleT H);
192-
#endif
171+
193172
JL_JITSymbol findSymbol(StringRef Name, bool ExportedSymbolsOnly);
194173
JL_JITSymbol findUnmangledSymbol(StringRef Name);
195174
uint64_t getGlobalValueAddress(StringRef Name);

src/llvm-late-gc-lowering.cpp

-16
Original file line numberDiff line numberDiff line change
@@ -397,12 +397,8 @@ CountTrackedPointers::CountTrackedPointers(Type *T) {
397397
if (isa<ArrayType>(T))
398398
count *= cast<ArrayType>(T)->getNumElements();
399399
else if (isa<VectorType>(T)) {
400-
#if JL_LLVM_VERSION >= 120000
401400
ElementCount EC = cast<VectorType>(T)->getElementCount();
402401
count *= EC.getKnownMinValue();
403-
#else
404-
count *= cast<VectorType>(T)->getNumElements();
405-
#endif
406402
}
407403
}
408404
if (count == 0)
@@ -415,12 +411,8 @@ unsigned getCompositeNumElements(Type *T) {
415411
else if (auto *AT = dyn_cast<ArrayType>(T))
416412
return AT->getNumElements();
417413
else {
418-
#if JL_LLVM_VERSION >= 120000
419414
ElementCount EC = cast<VectorType>(T)->getElementCount();
420415
return EC.getKnownMinValue();
421-
#else
422-
return cast<VectorType>(T)->getNumElements();
423-
#endif
424416
}
425417
}
426418

@@ -649,12 +641,8 @@ void LateLowerGCFrame::LiftSelect(State &S, SelectInst *SI) {
649641
std::vector<int> Numbers;
650642
unsigned NumRoots = 1;
651643
if (auto VTy = dyn_cast<VectorType>(SI->getType())) {
652-
#if JL_LLVM_VERSION >= 120000
653644
ElementCount EC = VTy->getElementCount();
654645
Numbers.resize(EC.getKnownMinValue(), -1);
655-
#else
656-
Numbers.resize(VTy->getNumElements(), -1);
657-
#endif
658646
}
659647
else
660648
assert(isa<PointerType>(SI->getType()) && "unimplemented");
@@ -715,12 +703,8 @@ void LateLowerGCFrame::LiftSelect(State &S, SelectInst *SI) {
715703
assert(NumRoots == 1);
716704
int Number = Numbers[0];
717705
Numbers.resize(0);
718-
#if JL_LLVM_VERSION >= 120000
719706
ElementCount EC = VTy->getElementCount();
720707
Numbers.resize(EC.getKnownMinValue(), Number);
721-
#else
722-
Numbers.resize(VTy->getNumElements(), Number);
723-
#endif
724708
}
725709
}
726710
if (!isa<PointerType>(SI->getType()))

src/llvm-version.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
#define JL_LLVM_VERSION (LLVM_VERSION_MAJOR * 10000 + LLVM_VERSION_MINOR * 100 \
1010
+ LLVM_VERSION_PATCH)
1111

12-
#if JL_LLVM_VERSION < 110000
13-
#error Only LLVM versions >= 11.0.0 are supported by Julia
12+
#if JL_LLVM_VERSION < 120000
13+
#error Only LLVM versions >= 12.0.0 are supported by Julia
1414
#endif
1515

1616
#ifdef __cplusplus

0 commit comments

Comments
 (0)