Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump LLVM to v19.1.1+1 #56130

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
224 changes: 112 additions & 112 deletions deps/checksums/clang

Large diffs are not rendered by default.

224 changes: 112 additions & 112 deletions deps/checksums/lld

Large diffs are not rendered by default.

456 changes: 228 additions & 228 deletions deps/checksums/llvm

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion deps/clang.version
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
## jll artifact
# Clang (paired with LLVM, only here as a JLL download)
CLANG_JLL_NAME := Clang
CLANG_JLL_VER := 18.1.7+3
CLANG_JLL_VER := 19.1.1+1
2 changes: 1 addition & 1 deletion deps/lld.version
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

## jll artifact
LLD_JLL_NAME := LLD
LLD_JLL_VER := 18.1.7+3
LLD_JLL_VER := 19.1.1+1
4 changes: 2 additions & 2 deletions deps/llvm-tools.version
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
## jll artifact
# LLVM_tools (downloads LLVM_jll to get things like `lit` and `opt`)
LLVM_TOOLS_JLL_NAME := LLVM
LLVM_TOOLS_JLL_VER := 18.1.7+3
LLVM_TOOLS_ASSERT_JLL_VER := 18.1.7+3
LLVM_TOOLS_JLL_VER := 19.1.1+1
LLVM_TOOLS_ASSERT_JLL_VER := 19.1.1+1
12 changes: 6 additions & 6 deletions deps/llvm.version
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

## jll artifact
LLVM_JLL_NAME := libLLVM
LLVM_ASSERT_JLL_VER := 18.1.7+3
LLVM_ASSERT_JLL_VER := 19.1.1+1
## source build
# Version number of LLVM
LLVM_VER := 18.1.7
LLVM_VER := 19.1.1
# Git branch name in `LLVM_GIT_URL` repository
LLVM_BRANCH=julia-18.1.7-2
LLVM_BRANCH=julia-19.1.1-1
# Git ref in `LLVM_GIT_URL` repository
LLVM_SHA1=julia-18.1.7-2
LLVM_SHA1=julia-19.1.1-1

## Following options are used to automatically fetch patchset from Julia's fork. This is
## useful if you want to build an external LLVM while still applying Julia's patches.
Expand All @@ -18,6 +18,6 @@ LLVM_APPLY_JULIA_PATCHES := 0
# GitHub repository to use for fetching the Julia patches to apply to LLVM source code.
LLVM_JULIA_DIFF_GITHUB_REPO := https://github.com/llvm/llvm-project
# Base GitHub ref for generating the diff.
LLVM_BASE_REF := llvm:llvmorg-18.1.7
LLVM_BASE_REF := llvm:llvmorg-19.1.1
# Julia fork's GitHub ref for generating the diff.
LLVM_JULIA_REF := JuliaLang:julia-18.1.7-2
LLVM_JULIA_REF := JuliaLang:julia-19.1.1-1
11 changes: 8 additions & 3 deletions deps/sanitizers.mk
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
# Interrogate the compiler about where it is keeping its sanitizer libraries
ifeq ($(USECLANG),1)
SANITIZER_LIB_PATH := $(shell LANG=C $(CC) -print-runtime-dir)
SANITIZER_LIB_PATH := $(shell LANG=C $(CC) -print-runtime-dir)\:$(subst $(eval ) ,:,$(abspath $(wildcard $(shell LANG=C $(CC) -print-resource-dir)/lib/*/)))
else
SANITIZER_LIB_PATH := $(dir $(shell LANG=C $(CC) -print-file-name=libasan.so))
endif

# Given a colon-separated list of paths in $(2), find the location of the library given in $(1)
define pathsearch_all
$(wildcard $(addsuffix /$(1),$(subst :, ,$(2))))
$(firstword $(wildcard $(addsuffix /$(1),$(subst :, ,$(2)))))
endef

define copy_sanitizer_lib
install-sanitizers: $$(addprefix $$(build_libdir)/, $$(notdir $$(call pathsearch_all,$(1),$$(SANITIZER_LIB_PATH)))) | $$(build_shlibdir)
$$(addprefix $$(build_shlibdir)/,$(2)): $$(addprefix $$(SANITIZER_LIB_PATH)/,$(2)) | $$(build_shlibdir)
@result=$$(call pathsearch_all,$(1),$$(SANITIZER_LIB_PATH)); \
if [ -z "$$$$result" ]; then \
echo "Sanitizer library $(1) not found in $$(SANITIZER_LIB_PATH)"; \
exit 1; \
fi
$$(addprefix $$(build_shlibdir)/,$(2)): $$(addprefix $$(dir $$(call pathsearch_all,$(1),$$(SANITIZER_LIB_PATH))),$(2)) | $$(build_shlibdir)
-cp $$< $$@
$(if $(filter $(OS), Linux), \
-$(PATCHELF) $(PATCHELF_SET_RPATH_ARG) '$$$$ORIGIN' $$@ , 0)
Expand Down
3 changes: 3 additions & 0 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ FLAGS += -Wall -Wno-strict-aliasing -fno-omit-frame-pointer -fvisibility=hidden
-Wno-comment -Wpointer-arith -Wundef
ifeq ($(USEGCC),1) # GCC bug #25509 (void)__attribute__((warn_unused_result))
FLAGS += -Wno-unused-result
# GCC is throwing warnings like `warning: 'int __builtin_memcmp_eq(const void*, const void*, long unsigned int)' specified bound 18446744073709551615 exceeds maximum object size 9223372036854775807` in llvm's StringRef.h == seemingly because it doesn't realise the size can't be 0.
FLAGS += -Wno-stringop-overflow
FLAGS += -Wno-stringop-overread
endif
JCFLAGS += -Wold-style-definition -Wstrict-prototypes -Wc++-compat

Expand Down
4 changes: 3 additions & 1 deletion src/cgmemmgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,15 +182,17 @@ static intptr_t get_anon_hdl(void) JL_NOTSAFEPOINT
pid_t pid = getpid();
// `shm_open` can't be mapped exec on mac
# ifndef _OS_DARWIN_
int shm_open_errno;
do {
snprintf(shm_name, sizeof(shm_name),
"julia-codegen-%d-%d", (int)pid, rand());
fd = shm_open(shm_name, O_RDWR | O_CREAT | O_EXCL, S_IRWXU);
shm_open_errno = errno; // check_fd_or_close trashes errno, so save beforehand
if (check_fd_or_close(fd)) {
shm_unlink(shm_name);
return fd;
}
} while (errno == EEXIST);
} while (shm_open_errno == EEXIST);
# endif
FILE *tmpf = tmpfile();
if (tmpf) {
Expand Down
3 changes: 3 additions & 0 deletions src/cgutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,9 @@ static Constant *literal_pointer_val_slot(jl_codectx_t &ctx, jl_value_t *p)
if (addr->smalltag) {
// some common builtin datatypes have a special pool for accessing them by smalltag id
Constant *tag = ConstantInt::get(getInt32Ty(ctx.builder.getContext()), addr->smalltag << 4);
#ifdef __clang_analyzer__
[[clang::suppress]] // Workaround https://github.com/llvm/llvm-project/issues/119415
#endif
Constant *smallp = ConstantExpr::getInBoundsGetElementPtr(getInt8Ty(ctx.builder.getContext()), prepare_global_in(jl_Module, jl_small_typeof_var), tag);
auto ty = ctx.types().T_ppjlvalue;
if (ty->getPointerAddressSpace() == smallp->getType()->getPointerAddressSpace())
Expand Down
2 changes: 1 addition & 1 deletion src/debuginfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1245,7 +1245,7 @@ extern "C" JL_DLLEXPORT_CODEGEN int jl_getFunctionInfo_impl(jl_frame_t **frames_
frames[0].line = -1;
*frames_out = frames;

llvm::DIContext *context;
llvm::DIContext *context = nullptr;
object::SectionRef Section;
int64_t slide;
uint64_t symsize;
Expand Down
19 changes: 14 additions & 5 deletions src/disasm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,9 @@ static void jl_strip_llvm_debug(Module *m, bool all_meta, LineNumberAnnotatedWri
if (AAW)
AAW->addDebugLoc(&inst, inst.getDebugLoc());
inst.setDebugLoc(DebugLoc());
#if JL_LLVM_VERSION >= 190000
inst.dropDbgRecords();
#endif
}
if (deletelast) {
deletelast->eraseFromParent();
Expand Down Expand Up @@ -869,6 +872,8 @@ static void jl_dump_asm_internal(
SourceMgr SrcMgr;

MCTargetOptions Options;
Options.AsmVerbose = true;
Options.MCUseDwarfDirectory = MCTargetOptions::EnableDwarfDirectory;
std::unique_ptr<MCAsmInfo> MAI(
TheTarget->createMCAsmInfo(*TheTarget->createMCRegInfo(TheTriple.str()), TheTriple.str(), Options));
assert(MAI && "Unable to create target asm info!");
Expand Down Expand Up @@ -1237,6 +1242,11 @@ jl_value_t *jl_dump_function_asm_impl(jl_llvmf_dump_t* dump, char emit_mc, const
});
auto TMBase = jl_ExecutionEngine->cloneTargetMachine();
LLVMTargetMachine *TM = static_cast<LLVMTargetMachine*>(TMBase.get());
MCTargetOptions &Options = TM->Options.MCOptions;
Options.AsmVerbose = true;
Options.MCUseDwarfDirectory = MCTargetOptions::EnableDwarfDirectory;
if (binary)
Options.ShowMCEncoding = true;
legacy::PassManager PM;
addTargetPasses(&PM, TM->getTargetTriple(), TM->getTargetIRAnalysis());
if (emit_mc) {
Expand Down Expand Up @@ -1266,8 +1276,8 @@ jl_value_t *jl_dump_function_asm_impl(jl_llvmf_dump_t* dump, char emit_mc, const
OutputAsmDialect = 1;
MCInstPrinter *InstPrinter = TM->getTarget().createMCInstPrinter(
jl_ExecutionEngine->getTargetTriple(), OutputAsmDialect, MAI, MII, MRI);
std::unique_ptr<MCAsmBackend> MAB(TM->getTarget().createMCAsmBackend(
STI, MRI, TM->Options.MCOptions));
std::unique_ptr<MCAsmBackend> MAB(TM->getTarget().createMCAsmBackend(
STI, MRI, Options));
std::unique_ptr<MCCodeEmitter> MCE;
if (binary) { // enable MCAsmStreamer::AddEncodingComment printing
MCE.reset(TM->getTarget().createMCCodeEmitter(MII, *Context));
Expand All @@ -1281,8 +1291,7 @@ jl_value_t *jl_dump_function_asm_impl(jl_llvmf_dump_t* dump, char emit_mc, const
std::move(MAB), false
#endif
));
std::unique_ptr<AsmPrinter> Printer(
TM->getTarget().createAsmPrinter(*TM, std::move(S)));
AsmPrinter *Printer = TM->getTarget().createAsmPrinter(*TM, std::move(S));
#if JL_LLVM_VERSION >= 190000
Printer->addDebugHandler(
std::make_unique<LineNumberPrinterHandler>(*Printer, debuginfo));
Expand All @@ -1293,7 +1302,7 @@ jl_value_t *jl_dump_function_asm_impl(jl_llvmf_dump_t* dump, char emit_mc, const
#endif
if (!Printer)
return jl_an_empty_string;
PM.add(Printer.release());
PM.add(Printer);
PM.add(createFreeMachineFunctionPass());
TSM->withModuleDo([&](Module &m){ PM.run(m); });
}
Expand Down
1 change: 1 addition & 0 deletions src/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,7 @@ static void *init_stdio_handle(const char *stdio, uv_os_fd_t fd, int readable)
// This also helps limit the impact other libraries can cause on our file handle.
if ((err = uv_dup(fd, &fd)))
jl_errorf("error initializing %s in uv_dup: %s (%s %d)", stdio, uv_strerror(err), uv_err_name(err), err);
assert(fd != -1); // This avoids a bug in clang's static analyzer, if an error did not occur, fd != -1
switch(uv_guess_handle(fd)) {
case UV_TTY:
handle = malloc_s(sizeof(uv_tty_t));
Expand Down
14 changes: 9 additions & 5 deletions src/jitlayers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1185,11 +1185,11 @@ class JLDebuginfoPlugin : public ObjectLinkingLayer::Plugin {

class JLMemoryUsagePlugin : public ObjectLinkingLayer::Plugin {
private:
std::atomic<size_t> &jit_bytes_size;
_Atomic(size_t)* jit_bytes_size;

public:

JLMemoryUsagePlugin(std::atomic<size_t> &jit_bytes_size)
JLMemoryUsagePlugin(_Atomic(size_t)* jit_bytes_size)
: jit_bytes_size(jit_bytes_size) {}

Error notifyFailed(orc::MaterializationResponsibility &MR) override {
Expand Down Expand Up @@ -1226,7 +1226,7 @@ class JLMemoryUsagePlugin : public ObjectLinkingLayer::Plugin {
}
(void) code_size;
(void) data_size;
this->jit_bytes_size.fetch_add(graph_size, std::memory_order_relaxed);
jl_atomic_fetch_add_relaxed(this->jit_bytes_size, graph_size)
jl_timing_counter_inc(JL_TIMING_COUNTER_JITSize, graph_size);
jl_timing_counter_inc(JL_TIMING_COUNTER_JITCodeSize, code_size);
jl_timing_counter_inc(JL_TIMING_COUNTER_JITDataSize, data_size);
Expand Down Expand Up @@ -1969,7 +1969,7 @@ JuliaOJIT::JuliaOJIT()
ES, std::move(ehRegistrar)));

ObjectLayer.addPlugin(std::make_unique<JLDebuginfoPlugin>());
ObjectLayer.addPlugin(std::make_unique<JLMemoryUsagePlugin>(jit_bytes_size));
ObjectLayer.addPlugin(std::make_unique<JLMemoryUsagePlugin>(&jit_bytes_size));
#else
UnlockedObjectLayer.setNotifyLoaded(registerRTDyldJITObject);
#endif
Expand Down Expand Up @@ -2081,7 +2081,7 @@ JuliaOJIT::JuliaOJIT()
reinterpret_cast<void *>(static_cast<uintptr_t>(msan_workaround::MSanTLS::origin))), JITSymbolFlags::Exported};
cantFail(GlobalJD.define(orc::absoluteSymbols(msan_crt)));
#endif
#if JL_LLVM_VERSION < 190000
#if JL_LLVM_VERSION < 200000
#ifdef _COMPILER_ASAN_ENABLED_
// this is a hack to work around a bad assertion:
// /workspace/srcdir/llvm-project/llvm/lib/ExecutionEngine/Orc/Core.cpp:3028: llvm::Error llvm::orc::ExecutionSession::OL_notifyResolved(llvm::orc::MaterializationResponsibility&, const SymbolMap&): Assertion `(KV.second.getFlags() & ~JITSymbolFlags::Common) == (I->second & ~JITSymbolFlags::Common) && "Resolving symbol with incorrect flags"' failed.
Expand Down Expand Up @@ -2126,15 +2126,19 @@ void JuliaOJIT::addModule(orc::ThreadSafeModule TSM)
// even though that shouldn't be the case and might be unwise
Expected<std::unique_ptr<MemoryBuffer>> Obj = CompileLayer.getCompiler()(M);
if (!Obj) {
#ifndef __clang_analyzer__ // reportError calls an arbitrary function, which the static analyzer thinks might be a safepoint
ES.reportError(Obj.takeError());
#endif
errs() << "Failed to add module to JIT!\n";
errs() << "Dumping failing module\n" << M << "\n";
return;
}
{ auto release = std::move(Lock); }
auto Err = JuliaOJIT::addObjectFile(JD, std::move(*Obj));
if (Err) {
#ifndef __clang_analyzer__ // reportError calls an arbitrary function, which the static analyzer thinks might be a safepoint
ES.reportError(std::move(Err));
#endif
errs() << "Failed to add objectfile to JIT!\n";
abort();
}
Expand Down
2 changes: 1 addition & 1 deletion src/signals-mach.c
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ static void jl_throw_in_thread(jl_ptls_t ptls2, mach_port_t thread, jl_value_t *
NULL /*current_task?*/);
ptls2->sig_exception = exception;
ptls2->io_wait = 0;
jl_task_t *ct = ptls2->current_task;
jl_task_t *ct = jl_atomic_load_relaxed(&ptls2->current_task);
jl_handler_t *eh = ct->eh;
if (eh != NULL) {
asan_unpoison_task_stack(ct, &eh->eh_ctx);
Expand Down
5 changes: 5 additions & 0 deletions src/threading.c
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,11 @@ JL_DLLEXPORT uint64_t jl_get_ptls_rng(void) JL_NOTSAFEPOINT
return jl_current_task->ptls->rngseed;
}


#if !defined(_OS_WINDOWS_) && !defined(JL_DISABLE_LIBUNWIND) && !defined(LLVMLIBUNWIND)
extern int unw_ensure_tls (void);
#endif

// get thread local rng
JL_DLLEXPORT void jl_set_ptls_rng(uint64_t new_seed) JL_NOTSAFEPOINT
{
Expand Down
6 changes: 3 additions & 3 deletions stdlib/LLD_jll/Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "LLD_jll"
uuid = "d55e3150-da41-5e91-b323-ecfd1eec6109"
version = "18.1.7+3"
version = "19.1.1+1"

[deps]
Zlib_jll = "83775a58-1f1d-513f-b197-d71354ab007a"
Expand All @@ -9,8 +9,8 @@ libLLVM_jll = "8f36deef-c2a5-5394-99ed-8e07531fb29a"
Artifacts = "56f22d72-fd6d-98f1-02f0-08ddc0907c33"

[compat]
julia = "1.11"
libLLVM_jll = "18.1.7"
julia = "1.12"
libLLVM_jll = "19.1.1"

[extras]
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Expand Down
4 changes: 2 additions & 2 deletions stdlib/libLLVM_jll/Project.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
name = "libLLVM_jll"
uuid = "8f36deef-c2a5-5394-99ed-8e07531fb29a"
version = "18.1.7+3"
version = "19.1.1+1"

[deps]
Libdl = "8f399da3-3557-5675-b5ff-fb832c97cbdb"
Artifacts = "56f22d72-fd6d-98f1-02f0-08ddc0907c33"

[compat]
julia = "1.11"
julia = "1.12"

[extras]
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Expand Down
Loading