Skip to content

Commit dbc38d6

Browse files
authored
Bump LLVM to v20 (#58142)
1 parent 2c2114c commit dbc38d6

File tree

19 files changed

+572
-542
lines changed

19 files changed

+572
-542
lines changed

contrib/refresh_checksums.mk

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,6 @@ checksum-$(1)-$(2)-$(3): clean-$(1)
5858
# Add this guy to his project target
5959
checksum-$(1): checksum-$(1)-$(2)-$(3)
6060

61-
# Add a dependency to the pack target
62-
# TODO: can we make this so it only adds an ordering but not a dependency?
63-
pack-checksum-$(1): | checksum-$(1)
64-
6561
# Add this guy to the `checksum` and `pack-checksum` default targets (e.g. `make -f contrib/refresh_checksums.mk openblas`)
6662
checksum: checksum-$1
6763
$1 pack-checksum: pack-checksum-$1
@@ -100,7 +96,7 @@ checksum-doc-unicodedata:
10096
all: checksum-doc-unicodedata
10197
.PHONY: checksum-doc-unicodedata
10298

103-
# merge substring project names to avoid races
99+
# merge substring project names (llvm and llvm-tools, libsuitesparse and suitesparse) to avoid races
104100
pack-checksum-llvm-tools: | pack-checksum-llvm
105101
@# nothing to do but disable the prefix rule
106102
pack-checksum-llvm: | checksum-llvm-tools
@@ -110,18 +106,21 @@ pack-checksum-compilersupportlibraries: | checksum-csl
110106
pack-checksum-libsuitesparse: | pack-checksum-suitesparse
111107
@# nothing to do but disable the prefix rule
112108
pack-checksum-suitesparse: | checksum-libsuitesparse
113-
# This is a bit tricky: we want llvmunwind to be separate from unwind and llvm,
109+
# This is a bit tricky: we want llvmunwind, clang, and lld to be separate from unwind and llvm,
114110
# so we add a rule to process those first
115111
pack-checksum-llvm pack-checksum-unwind: | pack-checksum-llvmunwind
116-
# and the name for LLVMLibUnwind is awkward, so handle that with a regex
117-
pack-checksum-llvmunwind: | pack-checksum-llvm.*unwind
112+
pack-checksum-llvm: | pack-checksum-clang pack-checksum-lld
113+
# and the name for LLVMLibUnwind is awkward, so handle that packing with a regex
114+
checksum-llvm.*unwind: checksum-llvmunwind
115+
@# nothing to do but disable the prefix rule
116+
pack-checksum-llvmunwind: | pack-checksum-llvm.*unwind # override general rule below
118117
cd "$(JULIAHOME)/deps/checksums" && mv 'llvm.*unwind' llvmunwind
119118

120119
clean-%: FORCE
121120
-rm "$(JULIAHOME)/deps/checksums"/'$*'
122121

123122
# define how to pack parallel checksums into a single file format
124-
pack-checksum-%: FORCE
123+
pack-checksum-%: FORCE | checksum-%
125124
@echo making "$(JULIAHOME)/deps/checksums/"'$*'
126125
@cd "$(JULIAHOME)/deps/checksums" && \
127126
for each in $$(ls | grep -i '$*'); do \

deps/checksums/clang

Lines changed: 120 additions & 0 deletions
Large diffs are not rendered by default.

deps/checksums/lld

Lines changed: 120 additions & 0 deletions
Large diffs are not rendered by default.

deps/checksums/llvm

Lines changed: 244 additions & 482 deletions
Large diffs are not rendered by default.

deps/clang.version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
## jll artifact
44
# Clang (paired with LLVM, only here as a JLL download)
55
CLANG_JLL_NAME := Clang
6-
CLANG_JLL_VER := 19.1.7+1
6+
CLANG_JLL_VER := 20.1.2+0

deps/lld.version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
## jll artifact
44
LLD_JLL_NAME := LLD
5-
LLD_JLL_VER := 19.1.7+1
5+
LLD_JLL_VER := 20.1.2+0

deps/llvm-tools.version

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
## jll artifact
44
# LLVM_tools (downloads LLVM_jll to get things like `lit` and `opt`)
55
LLVM_TOOLS_JLL_NAME := LLVM
6-
LLVM_TOOLS_JLL_VER := 19.1.7+1
7-
LLVM_TOOLS_ASSERT_JLL_VER := 19.1.7+1
6+
LLVM_TOOLS_JLL_VER := 20.1.2+0
7+
LLVM_TOOLS_ASSERT_JLL_VER := 20.1.2+0

deps/llvm.version

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22

33
## jll artifact
44
LLVM_JLL_NAME := libLLVM
5-
LLVM_ASSERT_JLL_VER := 19.1.7+2
5+
LLVM_ASSERT_JLL_VER := 20.1.2+0
66
## source build
77
# Version number of LLVM
8-
LLVM_VER := 19.1.7
8+
LLVM_VER := 20.1.2
99
# Git branch name in `LLVM_GIT_URL` repository
10-
LLVM_BRANCH=julia-19.1.7-2
10+
LLVM_BRANCH=julia-20.1.2-0
1111
# Git ref in `LLVM_GIT_URL` repository
12-
LLVM_SHA1=julia-19.1.7-2
12+
LLVM_SHA1=julia-20.1.2-0
1313

1414
## Following options are used to automatically fetch patchset from Julia's fork. This is
1515
## useful if you want to build an external LLVM while still applying Julia's patches.
@@ -18,6 +18,6 @@ LLVM_APPLY_JULIA_PATCHES := 0
1818
# GitHub repository to use for fetching the Julia patches to apply to LLVM source code.
1919
LLVM_JULIA_DIFF_GITHUB_REPO := https://github.com/llvm/llvm-project
2020
# Base GitHub ref for generating the diff.
21-
LLVM_BASE_REF := llvm:llvmorg-19.1.7
21+
LLVM_BASE_REF := llvm:llvmorg-20.1.2
2222
# Julia fork's GitHub ref for generating the diff.
23-
LLVM_JULIA_REF := JuliaLang:julia-19.1.7-2
23+
LLVM_JULIA_REF := JuliaLang:julia-20.1.2-0

src/Makefile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ endif
2929
JCFLAGS += -Wold-style-definition -Wstrict-prototypes -Wc++-compat
3030

3131
ifeq ($(USECLANG),1)
32-
FLAGS += -Wno-return-type-c-linkage -Wno-atomic-alignment
32+
FLAGS += -Wno-return-type-c-linkage -Wno-atomic-alignment -Wno-nullability-extension -Wno-nullability-completeness # required to be allowed to use nullability extension and not be required to annotate all of everything
3333
endif
3434

3535
ifeq (${USE_THIRD_PARTY_GC},mmtk)
@@ -226,6 +226,12 @@ DEBUGFLAGS_GCC += $(FLAGS) $(ADDL_DEBUGFLAGS)
226226
SHIPFLAGS_CLANG += $(FLAGS) $(ADDL_SHIPFLAGS)
227227
DEBUGFLAGS_CLANG += $(FLAGS) $(ADDL_DEBUGFLAGS)
228228

229+
DEBUGFLAGS_CLANG += -Wno-nullability-extension -Wno-nullability-completeness # required to be allowed to use nullability extension and not be required to annotate all of everything
230+
ifeq ($(USEGCC),1) # TODO: we currently set flags incorrectly for clang analyze, but mostly it works out okay
231+
DEBUGFLAGS_CLANG += -Wno-unknown-warning-option
232+
endif
233+
DEBUGFLAGS_CLANG += -Wno-return-type-c-linkage # TODO: do we care about fixing this instead? (it is not a bug, just a nuisance)
234+
229235
ifeq ($(USE_CROSS_FLISP), 1)
230236
FLISPDIR := $(BUILDDIR)/flisp/host
231237
FLISP_EXECUTABLE_debug := $(FLISPDIR)/flisp-debug$(BUILD_EXE)

src/genericmemory.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ jl_genericmemory_t *_new_genericmemory_(jl_value_t *mtype, size_t nel, int8_t is
5656
{
5757
if (nel == 0) // zero-sized allocation optimization
5858
return (jl_genericmemory_t*)((jl_datatype_t*)mtype)->instance;
59-
size_t nbytes;
59+
size_t nbytes = 0; // initialized to workaround clang sa bug on v20: https://github.com/llvm/llvm-project/issues/136292
6060
int overflow = __builtin_mul_overflow(nel, elsz, &nbytes);
6161
if (isunion) {
6262
// an extra byte for each isbits union memory element, stored at m->ptr + m->length
@@ -152,7 +152,7 @@ JL_DLLEXPORT jl_genericmemory_t *jl_ptr_to_genericmemory(jl_value_t *mtype, void
152152
if (((uintptr_t)data) & ((align > JL_HEAP_ALIGNMENT ? JL_HEAP_ALIGNMENT : align) - 1))
153153
jl_exceptionf(jl_argumenterror_type,
154154
"unsafe_wrap: pointer %p is not properly aligned to %u bytes", data, align);
155-
size_t nbytes;
155+
size_t nbytes = 0; // initialized to workaround clang sa bug on v20: https://github.com/llvm/llvm-project/issues/136292
156156
int overflow = __builtin_mul_overflow(nel, elsz, &nbytes);
157157
if (isunion) {
158158
// an extra byte for each isbits union memory element, stored at m->ptr + m->length
@@ -283,6 +283,9 @@ JL_DLLEXPORT jl_genericmemory_t *jl_genericmemory_copy_slice(jl_genericmemory_t
283283
memcpy(jl_genericmemory_typetagdata(new_mem), jl_genericmemory_typetagdata(mem) + (size_t)data, len);
284284
}
285285
else if (layout->first_ptr != -1) {
286+
if (data == NULL) {
287+
assert(len * elsz / sizeof(void*) == 0); // make static analyzer happy
288+
}
286289
memmove_refs((_Atomic(void*)*)new_mem->ptr, (_Atomic(void*)*)data, len * elsz / sizeof(void*));
287290
}
288291
else if (data != NULL) {

0 commit comments

Comments
 (0)