1- From 129a21e4fe99793e7ec7b16f3503e64c136c5702 Mon Sep 17 00:00:00 2001
1+ From 67be017d011f4237e5768fbc32e607ae25f814a1 Mon Sep 17 00:00:00 2001
2233Date: Sat, 4 Jan 2025 16:48:45 +0000
44Subject: [PATCH] 29e467fc78eb8b4308b57272ca4ad0d1f744f25f
@@ -8,18 +8,18 @@ Adapt to "Deprecate Type::getPointerTo()"
88 src/aotcompile.cpp | 10 +++++-----
99 src/ccall.cpp | 10 +++++-----
1010 src/cgutils.cpp | 4 ++--
11- src/codegen.cpp | 28 +++++++++++++- --------------
11+ src/codegen.cpp | 27 +++++++++++++--------------
1212 src/intrinsics.cpp | 6 +++---
13- src/llvm-codegen-shared.h | 22 +++++++++---- ---------
13+ src/llvm-codegen-shared.h | 14 +++++---------
1414 src/llvm-final-gc-lowering.cpp | 2 +-
1515 src/llvm-late-gc-lowering.cpp | 4 ++--
1616 src/llvm-multiversioning.cpp | 6 +++---
1717 src/llvm-pass-helpers.cpp | 2 +-
1818 src/llvm-ptls.cpp | 2 +-
19- 11 files changed, 45 insertions(+), 51 deletions(-)
19+ 11 files changed, 41 insertions(+), 46 deletions(-)
2020
2121diff --git a/src/aotcompile.cpp b/src/aotcompile.cpp
22- index 0600106c41..3583b4916b 100644
22+ index 0235758979..3291ddc5cc 100644
2323--- a/src/aotcompile.cpp
2424+++ b/src/aotcompile.cpp
2525@@ -1553,7 +1553,7 @@ static void construct_vars(Module &M, Partition &partition, StringRef suffix) {
@@ -62,7 +62,7 @@ index 0600106c41..3583b4916b 100644
6262 auto FT = FunctionType::get(T_int32, {T_pvoid, T_int32, T_pvoid}, false);
6363 auto F = Function::Create(FT, Function::ExternalLinkage, "_DllMainCRTStartup", metadataM);
6464diff --git a/src/ccall.cpp b/src/ccall.cpp
65- index 170adffc52..150a3e1c0d 100644
65+ index ad6dc4327c..6e9b546399 100644
6666--- a/src/ccall.cpp
6767+++ b/src/ccall.cpp
6868@@ -105,7 +105,7 @@ static bool runtime_sym_gvs(jl_codectx_t &ctx, const char *f_lib, const char *f_
@@ -101,7 +101,7 @@ index 170adffc52..150a3e1c0d 100644
101101 GlobalVariable *got = new GlobalVariable(*M, T_pvoidfunc, false,
102102 GlobalVariable::ExternalLinkage,
103103 plt,
104- @@ -2129 ,7 +2129 ,7 @@ jl_cgval_t function_sig_t::emit_a_ccall(
104+ @@ -2126 ,7 +2126 ,7 @@ jl_cgval_t function_sig_t::emit_a_ccall(
105105 }
106106 else if (symarg.fptr != NULL) {
107107 ++LiteralCCalls;
@@ -111,7 +111,7 @@ index 170adffc52..150a3e1c0d 100644
111111 setName(ctx.emission_context, llvmf, "ccall_fptr");
112112 }
113113diff --git a/src/cgutils.cpp b/src/cgutils.cpp
114- index 11f47dcf2e..77b67a5ce5 100644
114+ index 4f6eacbc4f..9b4a25cbd9 100644
115115--- a/src/cgutils.cpp
116116+++ b/src/cgutils.cpp
117117@@ -123,7 +123,7 @@ static Value *stringConstPtr(
@@ -133,7 +133,7 @@ index 11f47dcf2e..77b67a5ce5 100644
133133 for_each_uniontype_small(
134134 [&](unsigned idx, jl_datatype_t *jt) {
135135diff --git a/src/codegen.cpp b/src/codegen.cpp
136- index 5adf210489..519c16487f 100644
136+ index f463c25184..3fe7093768 100644
137137--- a/src/codegen.cpp
138138+++ b/src/codegen.cpp
139139@@ -838,7 +838,7 @@ static const auto jlhasnofield_func = new JuliaFunction<>{
@@ -162,24 +162,16 @@ index 5adf210489..519c16487f 100644
162162 {JuliaType::get_prjlvalue_ty(C), getPointerTy(C)}, false); },
163163 nullptr,
164164 };
165- @@ -1380,7 +1380,6 @@ static const auto jlgetcfunctiontrampoline_func = new JuliaFunction<>{
166- auto T_jlvalue = JuliaType::get_jlvalue_ty(C);
167- auto T_pjlvalue = PointerType::get(T_jlvalue, 0);
168- auto T_prjlvalue = PointerType::get(T_jlvalue, AddressSpace::Tracked);
169- - auto T_ppjlvalue = PointerType::get(T_pjlvalue, 0);
170- auto T_pprjlvalue = PointerType::get(T_prjlvalue, 0);
171- return FunctionType::get(T_prjlvalue,
172- {
173- @@ -1388,7 +1387,7 @@ static const auto jlgetcfunctiontrampoline_func = new JuliaFunction<>{
165+ @@ -1387,7 +1387,7 @@ static const auto jlgetcfunctiontrampoline_func = new JuliaFunction<>{
174166 T_pjlvalue, // result
175167 getPointerTy(C), // cache
176168 T_pjlvalue, // fill
177169- FunctionType::get(getPointerTy(C), { getPointerTy(C), T_ppjlvalue }, false)->getPointerTo(), // trampoline
178170+ getPointerTy(C), // trampoline
179171 T_pjlvalue, // env
180- T_pprjlvalue , // vals
172+ T_derived , // vals
181173 }, false);
182- @@ -1459 ,7 +1458,7 @@ static const auto box_ssavalue_func = new JuliaFunction<TypeFnContextAndSizeT>{
174+ @@ -1458 ,7 +1458,7 @@ static const auto box_ssavalue_func = new JuliaFunction<TypeFnContextAndSizeT>{
183175 };
184176 static const auto jlgetbuiltinfptr_func = new JuliaFunction<>{
185177 XSTR(jl_get_builtin_fptr),
@@ -188,7 +180,7 @@ index 5adf210489..519c16487f 100644
188180 {JuliaType::get_prjlvalue_ty(C)}, false); },
189181 nullptr,
190182 };
191- @@ -1547 ,7 +1546 ,7 @@ static const auto julia_call = new JuliaFunction<>{
183+ @@ -1550 ,7 +1550 ,7 @@ static const auto julia_call = new JuliaFunction<>{
192184 [](LLVMContext &C) {
193185 auto T_prjlvalue = JuliaType::get_prjlvalue_ty(C);
194186 return FunctionType::get(T_prjlvalue,
@@ -197,7 +189,7 @@ index 5adf210489..519c16487f 100644
197189 T_prjlvalue}, // %f
198190 true); }, // %args
199191 get_attrs_basic,
200- @@ -1560 ,7 +1559 ,7 @@ static const auto julia_call2 = new JuliaFunction<>{
192+ @@ -1563 ,7 +1563 ,7 @@ static const auto julia_call2 = new JuliaFunction<>{
201193 [](LLVMContext &C) {
202194 auto T_prjlvalue = JuliaType::get_prjlvalue_ty(C);
203195 return FunctionType::get(T_prjlvalue,
@@ -206,7 +198,7 @@ index 5adf210489..519c16487f 100644
206198 T_prjlvalue, // %arg1
207199 T_prjlvalue}, // %f
208200 true); }, // %args
209- @@ -1574 ,7 +1573 ,7 @@ static const auto julia_call3 = new JuliaFunction<>{
201+ @@ -1577 ,7 +1577 ,7 @@ static const auto julia_call3 = new JuliaFunction<>{
210202 auto T_prjlvalue = JuliaType::get_prjlvalue_ty(C);
211203 Type *T = PointerType::get(JuliaType::get_jlvalue_ty(C), AddressSpace::Derived);
212204 return FunctionType::get(T_prjlvalue,
@@ -215,7 +207,7 @@ index 5adf210489..519c16487f 100644
215207 T}, // %f
216208 true); }, // %args
217209 get_attrs_basic,
218- @@ -5474 ,7 +5473 ,7 @@ static jl_cgval_t emit_call_specfun_boxed(jl_codectx_t &ctx, jl_value_t *jlretty
210+ @@ -5551 ,7 +5551 ,7 @@ static jl_cgval_t emit_call_specfun_boxed(jl_codectx_t &ctx, jl_value_t *jlretty
219211 std::string namep("p");
220212 namep += specFunctionObject;
221213 GlobalVariable *GV = cast_or_null<GlobalVariable>(jl_Module->getNamedValue(namep));
@@ -224,7 +216,7 @@ index 5adf210489..519c16487f 100644
224216 if (GV == nullptr) {
225217 GV = new GlobalVariable(*jl_Module, pfunc, false,
226218 GlobalVariable::ExternalLinkage,
227- @@ -8127 ,8 +8126 ,7 @@ static jl_returninfo_t get_specsig_function(jl_codectx_t &ctx, Module *M, Value
219+ @@ -8175 ,8 +8175 ,7 @@ static jl_returninfo_t get_specsig_function(jl_codectx_t &ctx, Module *M, Value
228220 union_alloca_type((jl_uniontype_t*)jlrettype, allunbox, props.union_bytes, props.union_align, props.union_minalign);
229221 if (props.union_bytes) {
230222 props.cc = jl_returninfo_t::Union;
@@ -234,7 +226,7 @@ index 5adf210489..519c16487f 100644
234226 argnames.push_back("union_bytes_return");
235227 Type *pair[] = { ctx.types().T_prjlvalue, getInt8Ty(ctx.builder.getContext()) };
236228 rt = StructType::get(ctx.builder.getContext(), ArrayRef<Type*>(pair));
237- @@ -8157 ,7 +8155 ,7 @@ static jl_returninfo_t get_specsig_function(jl_codectx_t &ctx, Module *M, Value
229+ @@ -8205 ,7 +8204 ,7 @@ static jl_returninfo_t get_specsig_function(jl_codectx_t &ctx, Module *M, Value
238230 props.union_align = props.union_minalign = julia_alignment(jlrettype);
239231 // sret is always passed from alloca
240232 assert(M);
@@ -243,7 +235,7 @@ index 5adf210489..519c16487f 100644
243235 argnames.push_back("sret_return");
244236 srt = rt;
245237 rt = getVoidTy(ctx.builder.getContext());
246- @@ -8292 ,7 +8290 ,7 @@ static jl_returninfo_t get_specsig_function(jl_codectx_t &ctx, Module *M, Value
238+ @@ -8340 ,7 +8339 ,7 @@ static jl_returninfo_t get_specsig_function(jl_codectx_t &ctx, Module *M, Value
247239 }
248240 else {
249241 if (fval->getType()->isIntegerTy())
@@ -253,10 +245,10 @@ index 5adf210489..519c16487f 100644
253245 if (auto F = dyn_cast<Function>(fval)) {
254246 if (gcstack_arg && ctx.emission_context.use_swiftcc)
255247diff --git a/src/intrinsics.cpp b/src/intrinsics.cpp
256- index c2fb3760fd..594b8dd2e3 100644
248+ index 6365ff1660..d9c5fdb639 100644
257249--- a/src/intrinsics.cpp
258250+++ b/src/intrinsics.cpp
259- @@ -776 ,7 +776 ,7 @@ static jl_cgval_t emit_pointerref(jl_codectx_t &ctx, ArrayRef<jl_cgval_t> argv)
251+ @@ -780 ,7 +780 ,7 @@ static jl_cgval_t emit_pointerref(jl_codectx_t &ctx, ArrayRef<jl_cgval_t> argv)
260252 Type *ptrty = julia_type_to_llvm(ctx, ety, &isboxed);
261253 assert(!isboxed);
262254 if (!type_is_ghost(ptrty)) {
@@ -265,7 +257,7 @@ index c2fb3760fd..594b8dd2e3 100644
265257 thePtr = ctx.builder.CreateInBoundsGEP(ptrty, thePtr, im1);
266258 auto load = typed_load(ctx, thePtr, nullptr, ety, ctx.tbaa().tbaa_data, nullptr, isboxed, AtomicOrdering::NotAtomic, false, align_nb);
267259 setName(ctx.emission_context, load.V, "pointerref");
268- @@ -968 ,7 +968 ,7 @@ static jl_cgval_t emit_atomic_pointerref(jl_codectx_t &ctx, ArrayRef<jl_cgval_t>
260+ @@ -972 ,7 +972 ,7 @@ static jl_cgval_t emit_atomic_pointerref(jl_codectx_t &ctx, ArrayRef<jl_cgval_t>
269261 Type *ptrty = julia_type_to_llvm(ctx, ety, &isboxed);
270262 assert(!isboxed);
271263 if (!type_is_ghost(ptrty)) {
@@ -274,7 +266,7 @@ index c2fb3760fd..594b8dd2e3 100644
274266 auto load = typed_load(ctx, thePtr, nullptr, ety, ctx.tbaa().tbaa_data, nullptr, isboxed, llvm_order, false, nb);
275267 setName(ctx.emission_context, load.V, "atomic_pointerref");
276268 return load;
277- @@ -1062 ,7 +1062 ,7 @@ static jl_cgval_t emit_atomic_pointerop(jl_codectx_t &ctx, intrinsic f, ArrayRef
269+ @@ -1066 ,7 +1066 ,7 @@ static jl_cgval_t emit_atomic_pointerop(jl_codectx_t &ctx, intrinsic f, ArrayRef
278270 assert(!isboxed);
279271 Value *thePtr;
280272 if (!type_is_ghost(ptrty))
@@ -284,10 +276,10 @@ index c2fb3760fd..594b8dd2e3 100644
284276 thePtr = nullptr; // could use any value here, since typed_store will not use it
285277 jl_cgval_t ret = typed_store(ctx, thePtr, x, y, ety, ctx.tbaa().tbaa_data, nullptr, nullptr, isboxed,
286278diff --git a/src/llvm-codegen-shared.h b/src/llvm-codegen-shared.h
287- index d9551e0552..35d2bda072 100644
279+ index ff6f5a9729..ecf02a8f57 100644
288280--- a/src/llvm-codegen-shared.h
289281+++ b/src/llvm-codegen-shared.h
290- @@ -34,24 +34,24 @@ namespace JuliaType {
282+ @@ -34,19 +34,19 @@ namespace JuliaType {
291283 }
292284
293285 static inline llvm::PointerType* get_pjlvalue_ty(llvm::LLVMContext &C, unsigned addressSpace=0) {
@@ -311,40 +303,7 @@ index d9551e0552..35d2bda072 100644
311303 }
312304
313305 static inline auto get_jlfunc_ty(llvm::LLVMContext &C) {
314- auto T_prjlvalue = get_prjlvalue_ty(C);
315- - auto T_pprjlvalue = llvm::PointerType::get(T_prjlvalue, 0);
316- + auto T_pprjlvalue = llvm::PointerType::get(C, 0);
317- return llvm::FunctionType::get(T_prjlvalue, {
318- T_prjlvalue, // function
319- T_pprjlvalue, // args[]
320- @@ -61,7 +61,7 @@ namespace JuliaType {
321-
322- static inline auto get_jlfunc2_ty(llvm::LLVMContext &C) {
323- auto T_prjlvalue = get_prjlvalue_ty(C);
324- - auto T_pprjlvalue = llvm::PointerType::get(T_prjlvalue, 0);
325- + auto T_pprjlvalue = llvm::PointerType::get(C, 0);
326- return llvm::FunctionType::get(T_prjlvalue, {
327- T_prjlvalue, // function
328- T_pprjlvalue, // args[]
329- @@ -72,7 +72,7 @@ namespace JuliaType {
330-
331- static inline auto get_jlfunc3_ty(llvm::LLVMContext &C) {
332- auto T_prjlvalue = get_prjlvalue_ty(C);
333- - auto T_pprjlvalue = llvm::PointerType::get(T_prjlvalue, 0);
334- + auto T_pprjlvalue = llvm::PointerType::get(C, 0);
335- auto T = get_pjlvalue_ty(C, Derived);
336- return llvm::FunctionType::get(T_prjlvalue, {
337- T, // function
338- @@ -83,7 +83,7 @@ namespace JuliaType {
339-
340- static inline auto get_jlfuncparams_ty(llvm::LLVMContext &C) {
341- auto T_prjlvalue = get_prjlvalue_ty(C);
342- - auto T_pprjlvalue = llvm::PointerType::get(T_prjlvalue, 0);
343- + auto T_pprjlvalue = llvm::PointerType::get(C, 0);
344- return llvm::FunctionType::get(T_prjlvalue, {
345- T_prjlvalue, // function
346- T_pprjlvalue, // args[]
347- @@ -96,10 +96,6 @@ namespace JuliaType {
306+ @@ -95,10 +95,6 @@ namespace JuliaType {
348307 static inline auto get_voidfunc_ty(llvm::LLVMContext &C) {
349308 return llvm::FunctionType::get(llvm::Type::getVoidTy(C), /*isVarArg*/false);
350309 }
@@ -355,7 +314,7 @@ index d9551e0552..35d2bda072 100644
355314 }
356315
357316 // return how many Tracked pointers are in T (count > 0),
358- @@ -229 ,7 +225 ,7 @@ static inline void emit_gc_safepoint(llvm::IRBuilder<> &builder, llvm::Type *T_s
317+ @@ -228 ,7 +224 ,7 @@ static inline void emit_gc_safepoint(llvm::IRBuilder<> &builder, llvm::Type *T_s
359318 else {
360319 Function *F = M->getFunction("julia.safepoint");
361320 if (!F) {
@@ -378,7 +337,7 @@ index 76dcd94489..4e539fea8f 100644
378337
379338 // Zero out the GC frame.
380339diff --git a/src/llvm-late-gc-lowering.cpp b/src/llvm-late-gc-lowering.cpp
381- index 45ac0e0980..e9ea2fdc27 100644
340+ index e03fbd8ccd..317e89d46a 100644
382341--- a/src/llvm-late-gc-lowering.cpp
383342+++ b/src/llvm-late-gc-lowering.cpp
384343@@ -1993,7 +1993,7 @@ bool LateLowerGCFrame::CleanupIR(Function &F, State *S, bool *CFGModified) {
0 commit comments