1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
This patch is from julialang repository:
https://github.com/JuliaLang/julia/commit/47f9139e.patch
but reference comes form ARCH Linux juia package
https://github.com/archlinux/svntogit-community/tree/packages/julia/trunk
From 47f9139e88917813cb7beee5e690c48c2ac65de4 Mon Sep 17 00:00:00 2001
From: Xuanda Yang <th3charlie@gmail.com>
Date: Wed, 9 Jun 2021 22:35:14 +0800
Subject: [PATCH] codegen: replace deprecated llvm::VectorType::getNumElements
with new APIs (#41144)
---
src/llvm-late-gc-lowering.cpp | 29 ++++++++++++++++++++++++++---
1 file changed, 26 insertions(+), 3 deletions(-)
diff --git a/src/llvm-late-gc-lowering.cpp b/src/llvm-late-gc-lowering.cpp
index 50015045151b..4df303462d96 100644
--- a/src/llvm-late-gc-lowering.cpp
+++ b/src/llvm-late-gc-lowering.cpp
@@ -396,8 +396,14 @@ CountTrackedPointers::CountTrackedPointers(Type *T) {
}
if (isa<ArrayType>(T))
count *= cast<ArrayType>(T)->getNumElements();
- else if (isa<VectorType>(T))
+ else if (isa<VectorType>(T)) {
+#if JL_LLVM_VERSION >= 120000
+ ElementCount EC = cast<VectorType>(T)->getElementCount();
+ count *= EC.getKnownMinValue();
+#else
count *= cast<VectorType>(T)->getNumElements();
+#endif
+ }
}
if (count == 0)
all = false;
@@ -408,8 +414,14 @@ unsigned getCompositeNumElements(Type *T) {
return ST->getNumElements();
else if (auto *AT = dyn_cast<ArrayType>(T))
return AT->getNumElements();
- else
+ else {
+#if JL_LLVM_VERSION >= 120000
+ ElementCount EC = cast<VectorType>(T)->getElementCount();
+ return EC.getKnownMinValue();
+#else
return cast<VectorType>(T)->getNumElements();
+#endif
+ }
}
// Walk through a Type, and record the element path to every tracked value inside
@@ -625,8 +637,14 @@ void LateLowerGCFrame::LiftSelect(State &S, SelectInst *SI) {
}
std::vector<int> Numbers;
unsigned NumRoots = 1;
- if (auto VTy = dyn_cast<VectorType>(SI->getType()))
+ if (auto VTy = dyn_cast<VectorType>(SI->getType())) {
+#if JL_LLVM_VERSION >= 120000
+ ElementCount EC = VTy->getElementCount();
+ Numbers.resize(EC.getKnownMinValue(), -1);
+#else
Numbers.resize(VTy->getNumElements(), -1);
+#endif
+ }
else
assert(isa<PointerType>(SI->getType()) && "unimplemented");
assert(!isTrackedValue(SI));
@@ -686,7 +704,12 @@ void LateLowerGCFrame::LiftSelect(State &S, SelectInst *SI) {
assert(NumRoots == 1);
int Number = Numbers[0];
Numbers.resize(0);
+#if JL_LLVM_VERSION >= 120000
+ ElementCount EC = VTy->getElementCount();
+ Numbers.resize(EC.getKnownMinValue(), Number);
+#else
Numbers.resize(VTy->getNumElements(), Number);
+#endif
}
}
if (!isa<PointerType>(SI->getType()))
|