1- From d919ba7970703320ccfd2f41a81e14084bb74049 Mon Sep 17 00:00:00 2001
1+ From 2628dd59664b2768af344cd5f02afc484027f83d Mon Sep 17 00:00:00 2001
22From: Jameson Nash <vtjnash@gmail.com>
33Date: Wed, 29 Jul 2026 15:12:45 +0000
44Subject: [PATCH 09/11] codegen: add support for llvm-22
@@ -18,10 +18,10 @@ Subject: [PATCH 09/11] codegen: add support for llvm-22
1818 11 files changed, 95 insertions(+), 18 deletions(-)
1919
2020diff --git a/src/Makefile b/src/Makefile
21- index 8292c7bbe2..15b21e35ad 100644
21+ index 7398a14da9..4d06db230e 100644
2222--- a/src/Makefile
2323+++ b/src/Makefile
24- @@ -765 ,16 +765 ,18 @@ SA_EXCEPTIONS-gc-stock.c := -Xanalyzer -analyzer-config -Xana
24+ @@ -767 ,16 +767 ,18 @@ SA_EXCEPTIONS-gc-stock.c := -Xanalyzer -analyzer-config -Xana
2525 # these need to be annotated (and possibly fixed)
2626 SKIP_GC_CHECK := codegen.cpp rtutils.c
2727
@@ -101,10 +101,10 @@ index 2664fee69f..b9f01b2658 100644
101101 const MemRegion *R = LVal.getAsRegion();
102102 if (!R) {
103103diff --git a/src/codegen.cpp b/src/codegen.cpp
104- index d4984b24e3..ba339d0715 100644
104+ index d91e926bd5..d604d672ef 100644
105105--- a/src/codegen.cpp
106106+++ b/src/codegen.cpp
107- @@ -10477 ,7 +10477 ,7 @@ jl_code_info_t *jl_get_method_ir(jl_code_instance_t *ci)
107+ @@ -10659 ,7 +10659 ,7 @@ jl_code_info_t *jl_get_method_ir(jl_code_instance_t *ci)
108108 void emit_always_inline(jl_codegen_output_t &out,
109109 unique_function<jl_code_info_t *(jl_code_instance_t *)> get_src)
110110 {
@@ -152,7 +152,7 @@ index 26b95fdb16..f82a192367 100644
152152
153153 MCContext Ctx(TheTriple, MAI.get(), MRI.get(), STI.get(), &SrcMgr);
154154diff --git a/src/jitlayers.cpp b/src/jitlayers.cpp
155- index dbf874ec79..07bee4f783 100644
155+ index a1c4556275..5f292a78b2 100644
156156--- a/src/jitlayers.cpp
157157+++ b/src/jitlayers.cpp
158158@@ -14,7 +14,11 @@
@@ -167,7 +167,7 @@ index dbf874ec79..07bee4f783 100644
167167 #if JL_LLVM_VERSION >= 210000
168168 # include <llvm/ExecutionEngine/Orc/SelfExecutorProcessControl.h>
169169 #endif
170- @@ -2118 ,9 +2122 ,11 @@ void JuliaOJIT::enableJITDebuggingSupport()
170+ @@ -2125 ,9 +2129 ,11 @@ void JuliaOJIT::enableJITDebuggingSupport()
171171 {
172172 orc::SymbolMap GDBFunctions;
173173 addAbsoluteToMap(GDBFunctions,llvm_orc_registerJITLoaderGDBAllocAction);
@@ -180,7 +180,7 @@ index dbf874ec79..07bee4f783 100644
180180 if (TM->getTargetTriple().isOSBinFormatMachO()) {
181181 auto RegisterSym = cantFail(
182182 safelookup(ES, {&JD}, ES.intern("_llvm_orc_registerJITLoaderGDBAllocAction")));
183- @@ -2129 ,8 +2135 ,22 @@ void JuliaOJIT::enableJITDebuggingSupport()
183+ @@ -2136 ,8 +2142 ,22 @@ void JuliaOJIT::enableJITDebuggingSupport()
184184 }
185185 #ifndef _COMPILER_ASAN_ENABLED_ // TODO: Fix duplicated sections spam #51794
186186 else if (TM->getTargetTriple().isOSBinFormatELF()) {
@@ -203,7 +203,7 @@ index dbf874ec79..07bee4f783 100644
203203 }
204204 #endif
205205 }
206- @@ -2356 ,7 +2376 ,7 @@ bool JuliaOJIT::linkOutput(orc::MaterializationResponsibility &MR, MemoryBufferR
206+ @@ -2363 ,7 +2383 ,7 @@ bool JuliaOJIT::linkOutput(orc::MaterializationResponsibility &MR, MemoryBufferR
207207 continue;
208208 }
209209 JL_GC_PROMISE_ROOTED(CI);
@@ -213,10 +213,10 @@ index dbf874ec79..07bee4f783 100644
213213 return false;
214214 if (auto *DestSym = findLinkGraphSymbolByName(G, Dest);
215215diff --git a/src/jitlayers.h b/src/jitlayers.h
216- index 6b3de497a0..bb5a882bf3 100644
216+ index 47af9acda6..abb46a2132 100644
217217--- a/src/jitlayers.h
218218+++ b/src/jitlayers.h
219- @@ -410 ,7 +410 ,10 @@ private:
219+ @@ -419 ,7 +419 ,10 @@ private:
220220
221221 struct jl_linker_info_t {
222222 DenseMap<jl_code_instance_t *, jl_codeinst_funcs_t<orc::SymbolStringPtr>> ci_funcs;
@@ -228,7 +228,7 @@ index 6b3de497a0..bb5a882bf3 100644
228228 call_targets;
229229 DenseMap<void *, orc::SymbolStringPtr> global_targets;
230230 };
231- @@ -456 ,7 +459 ,9 @@ public:
231+ @@ -465 ,7 +468 ,9 @@ public:
232232
233233 public:
234234 // outputs
@@ -240,10 +240,10 @@ index 6b3de497a0..bb5a882bf3 100644
240240 DenseMap<jl_code_instance_t *, jl_llvm_functions_t> ci_funcs;
241241 SmallVector<std::pair<jl_code_instance_t *, GlobalVariable *>, 0> external_fns;
242242diff --git a/src/julia_threads.h b/src/julia_threads.h
243- index 605e1c73e3..48c571d0a3 100644
243+ index 24ec348c2d..6e2d48c9a2 100644
244244--- a/src/julia_threads.h
245245+++ b/src/julia_threads.h
246- @@ -166 ,7 +166 ,7 @@ typedef struct _jl_tls_states_t {
246+ @@ -215 ,7 +215 ,7 @@ typedef struct _jl_tls_states_t {
247247 struct _jl_task_t *root_task;
248248 struct _jl_timing_block_t *timing_stack;
249249 // This is the location of our copy_stack
@@ -283,7 +283,7 @@ index a3f07f03e4..214def0c9e 100644
283283 #else
284284 CallInst::Create(pass.lifetime_start, {sz, ptr}, "", orig);
285285diff --git a/src/llvm-late-gc-lowering.cpp b/src/llvm-late-gc-lowering.cpp
286- index 309916001d..30a3bbbb40 100644
286+ index c9a75759de..690cb08509 100644
287287--- a/src/llvm-late-gc-lowering.cpp
288288+++ b/src/llvm-late-gc-lowering.cpp
289289@@ -182,8 +182,15 @@ static std::pair<Value*,int> FindBaseValue(const State &S, Value *V, bool UseCac
0 commit comments