Skip to content
Closed
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
188 changes: 68 additions & 120 deletions deps/checksums/clang

Large diffs are not rendered by default.

188 changes: 68 additions & 120 deletions deps/checksums/lld

Large diffs are not rendered by default.

380 changes: 138 additions & 242 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 := 20.1.8+0
CLANG_JLL_VER := 21.1.8+0
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 := 20.1.8+0
LLD_JLL_VER := 21.1.8+0
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 := 20.1.8+0
LLVM_TOOLS_ASSERT_JLL_VER := 20.1.8+0
LLVM_TOOLS_JLL_VER := 21.1.8+0
LLVM_TOOLS_ASSERT_JLL_VER := 21.1.8+0
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 := 20.1.8+0
LLVM_ASSERT_JLL_VER := 21.1.8+0
## source build
# Version number of LLVM
LLVM_VER := 20.1.8
LLVM_VER := 21.1.8
# Git branch name in `LLVM_GIT_URL` repository
LLVM_BRANCH=julia-20.1.8-0
LLVM_BRANCH=julia-21.1.8-0
# Git ref in `LLVM_GIT_URL` repository
LLVM_SHA1=julia-20.1.8-0
LLVM_SHA1=julia-21.1.8-0

## 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-20.1.8
LLVM_BASE_REF := llvm:llvmorg-21.1.8
# Julia fork's GitHub ref for generating the diff.
LLVM_JULIA_REF := JuliaLang:julia-20.1.8-0
LLVM_JULIA_REF := JuliaLang:$(LLVM_SHA1)
5 changes: 5 additions & 0 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ FLAGS_GCC += -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_GCC += -Wno-stringop-overflow
FLAGS_GCC += -Wno-stringop-overread
# LLVM 21 causes maybe uninitialized warnings in include/llvm/ADT/DenseMap.h
FLAGS_GCC += -Wno-maybe-uninitialized

# Required to be allowed to use nullability extension and not be required to annotate all of everything
JCFLAGS_CLANG += -Wno-atomic-alignment -Wno-nullability-extension -Wno-nullability-completeness
Expand Down Expand Up @@ -640,6 +642,9 @@ SA_EXCEPTIONS-jloptions.c := -Xanalyzer -analyzer-config -Xana
# clang doesn't understand that e->vars has the same value in save_env (NULL) and restore_env (assumed non-NULL)
SA_EXCEPTIONS-subtype.c := -Xanalyzer -analyzer-config -Xanalyzer silence-checkers="core.uninitialized.Assign;core.UndefinedBinaryOperatorResult"
SA_EXCEPTIONS-codegen.c := -Xanalyzer -analyzer-config -Xanalyzer silence-checkers="core"
# core.FixedAddressDereference is new in clang 21 and false-positives on LLVM ilist headers and gc_read_stack
SA_EXCEPTIONS-llvm-alloc-opt.cpp := -Xanalyzer -analyzer-config -Xanalyzer silence-checkers="core.FixedAddressDereference"
SA_EXCEPTIONS-gc-stock.c := -Xanalyzer -analyzer-config -Xanalyzer silence-checkers="core.FixedAddressDereference"
# these need to be annotated (and possibly fixed)
SKIP_GC_CHECK := codegen.cpp rtutils.c

Expand Down
11 changes: 11 additions & 0 deletions src/abi_win32.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,20 @@ bool needPassByRef(jl_datatype_t *dt, AttrBuilder &ab, LLVMContext &ctx, Type *T
{
// Use pass by reference for all structs
if (dt->layout->nfields > 0 || dt->layout->npointers) {
// Avoid using i128 directly as a byval type since LLVM gives it 16-byte
// stack alignment on x86-32, while the C ABI uses 4-byte alignment.
if (Ty->isIntegerTy() && Ty->getIntegerBitWidth() > 64)
Ty = ArrayType::get(Type::getInt32Ty(ctx), jl_datatype_size(dt) / 4);
ab.addByValAttr(Ty);
return true;
}
// Large primitive types (like Int128) must also be passed by reference
// to avoid i128's 16-byte stack alignment in LLVM.
size_t size = jl_datatype_size(dt);
if (jl_is_primitivetype(dt) && size > 8) {
ab.addByValAttr(ArrayType::get(Type::getInt32Ty(ctx), size / 4));
return true;
}
return false;
}

Expand Down
5 changes: 5 additions & 0 deletions src/abi_x86.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@ bool needPassByRef(jl_datatype_t *dt, AttrBuilder &ab, LLVMContext &ctx, Type *T
size_t size = jl_datatype_size(dt);
if (is_complex64(dt) || is_complex128(dt) || (jl_is_primitivetype(dt) && size <= 8))
return false;
// Avoid using i128 directly as a byval type since LLVM gives it 16-byte
// stack alignment on x86-32, while the C ABI uses 4-byte alignment.
// Use an array of i32 instead, which naturally has 4-byte alignment.
if (Ty->isIntegerTy() && Ty->getIntegerBitWidth() > 64)
Ty = ArrayType::get(Type::getInt32Ty(ctx), size / 4);
ab.addByValAttr(Ty);
return true;
}
Expand Down
5 changes: 5 additions & 0 deletions src/aotcompile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -338,10 +338,15 @@ class egal_set {
egal_set() = default;
void insert(jl_value_t *val)
{
// list/keyset are GC-rooted by the caller via JL_GC_PUSH
JL_GC_PROMISE_ROOTED(val);
JL_GC_PROMISE_ROOTED(list);
JL_GC_PROMISE_ROOTED(keyset);
jl_value_t *rval = jl_idset_get(list, keyset, val);
if (rval == NULL) {
ssize_t idx;
list = jl_idset_put_key(list, val, &idx);
JL_GC_PROMISE_ROOTED(list);
keyset = jl_idset_put_idx(list, keyset, idx);
}
}
Expand Down
11 changes: 6 additions & 5 deletions src/clangsa/GCChecker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1050,7 +1050,7 @@ bool GCChecker::processAllocationOfResult(const CallEvent &Call,
SymbolRef Sym = Call.getReturnValue().getAsSymbol();
if (!Sym) {
SVal S = C.getSValBuilder().conjureSymbolVal(
Call.getOriginExpr(), C.getLocationContext(), QT, C.blockCount());
C.getCFGElementRef(), C.getLocationContext(), QT, C.blockCount());
State = State->BindExpr(Call.getOriginExpr(), C.getLocationContext(), S);
Sym = S.getAsSymbol();
}
Expand Down Expand Up @@ -1146,8 +1146,8 @@ SymbolRef GCChecker::getSymbolForResult(const Expr *Result,
if (Loaded.isUnknown() || !Loaded.getAsSymbol()) {
if (OldValS || GCChecker::isGCTracked(Result)) {
Loaded = C.getSValBuilder().conjureSymbolVal(
nullptr, Result, C.getLocationContext(), Result->getType(),
C.blockCount());
nullptr, C.getCFGElementRef(), C.getLocationContext(),
Result->getType(), C.blockCount());
State = State->bindLoc(*ValLoc, Loaded, C.getLocationContext());
// State = State->BindExpr(Result, C.getLocationContext(),
// State->getSVal(*ValLoc));
Expand Down Expand Up @@ -1201,7 +1201,7 @@ void GCChecker::checkDerivingExpr(const Expr *Result, const Expr *Parent,
return;
}
ResultVal = C.getSValBuilder().conjureSymbolVal(
Result, C.getLocationContext(), Result->getType(),
C.getCFGElementRef(), C.getLocationContext(), Result->getType(),
C.blockCount());
State = State->BindExpr(Result, C.getLocationContext(), ResultVal);
}
Expand Down Expand Up @@ -1544,7 +1544,8 @@ bool GCChecker::evalCall(const CallEvent &Call, CheckerContext &C) const {
SVal Items = State->getSVal(ItemsLoc);
if (Items.isUnknown()) {
Items = C.getSValBuilder().conjureSymbolVal(
CE, C.getLocationContext(), FD->getType(), C.blockCount());
C.getCFGElementRef(), C.getLocationContext(), FD->getType(),
C.blockCount());
State = State->bindLoc(ItemsLoc, Items, C.getLocationContext());
}
assert(Items.getAsRegion());
Expand Down
15 changes: 13 additions & 2 deletions src/jitlayers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1688,7 +1688,17 @@ void optimizeDLSyms(Module &M) JL_NOTSAFEPOINT_LEAVE JL_NOTSAFEPOINT_ENTER {
void fixupTM(TargetMachine &TM) {
auto TheTriple = TM.getTargetTriple();
if (jl_options.opt_level < 2) {
if (!TheTriple.isARM() && !TheTriple.isPPC64() && !TheTriple.isAArch64())
// Try GlobalISel on AArch64 - it's the default in LLVM at -O0 and
// is apparently generally faster than SelectionDAG while producing good code.
// Use fallback mode so unsupported patterns fall back to SelectionDAG.
// Note: Requires RemoveJuliaAddrspacesPass to run before codegen
// because GlobalISel doesn't handle Julia's custom address spaces.
if (TheTriple.isAArch64()) {
TM.setGlobalISel(true);
TM.setGlobalISelAbort(GlobalISelAbortMode::Disable);
TM.setFastISel(false);
}
else if (!TheTriple.isARM() && !TheTriple.isPPC64())
TM.setFastISel(true);
else // FastISel seems to be buggy Ref #13321
TM.setFastISel(false);
Expand Down Expand Up @@ -1736,8 +1746,9 @@ JuliaOJIT::JuliaOJIT()
ObjectLayer.addPlugin(std::make_unique<EHFrameRegistrationPlugin>(
ExecutorAddr::fromPtr(JLEHFrames::registerEHFrameSectionAllocAction),
ExecutorAddr::fromPtr(JLEHFrames::deregisterEHFrameSectionAllocAction)));
#endif
# else
ObjectLayer.addPlugin(cantFail(EHFrameRegistrationPlugin::Create(ES)));
# endif
#endif

ObjectLayer.addPlugin(DebuginfoPlugin);
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 = "20.1.8+0"
version = "21.1.8+0"

[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.13"
libLLVM_jll = "20.1.8"
julia = "1.14"
libLLVM_jll = "21.1.8"

[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,6 +1,6 @@
name = "libLLVM_jll"
uuid = "8f36deef-c2a5-5394-99ed-8e07531fb29a"
version = "20.1.8+0"
version = "21.1.8+0"

[deps]
Artifacts = "56f22d72-fd6d-98f1-02f0-08ddc0907c33"
Expand All @@ -13,7 +13,7 @@ Zstd_jll = "3161d3a3-bdf6-5164-811a-617609db77b4"
CompilerSupportLibraries_jll = "1.3.0"
Zlib_jll = "1"
Zstd_jll = "1.5.7"
julia = "1.13"
julia = "1.14"

[extras]
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Expand Down
12 changes: 12 additions & 0 deletions test/atomics.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1115,3 +1115,15 @@ function add_one57190!()
end

@test add_one57190!() == 1

# Test atomic Float16 operations at all optimization levels (GlobalISel miscompile on AArch64)
# See https://github.com/JuliaLang/julia/pull/54140#issuecomment-2855794363
for opt in 0:3
@test success(run(```$(Base.julia_cmd()) --startup-file=no -O$opt -e '
a = Threads.Atomic{Float16}(Float16(0))
a[] = Float16(1.5)
@assert a[] === Float16(1.5) "atomic Float16 store failed: got \$(a[]) expected 1.5 (opt level = -O$(Base.JLOptions().opt_level))"
a[] = Float16(3.25)
@assert a[] === Float16(3.25) "atomic Float16 store failed: got \$(a[]) expected 3.25 (opt level = -O$(Base.JLOptions().opt_level))"
'```))
end
Loading