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

LLVM 20 #22780

Draft
wants to merge 32 commits into
base: master
Choose a base branch
from
Draft

LLVM 20 #22780

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
7e63525
ci: llvm19 -> llvm20.
alexrp Feb 5, 2025
f842ee3
cmake: Update to LLVM/Clang 20.
alexrp Feb 5, 2025
9145476
zig cc: Update driver files to Clang 20.
alexrp Feb 5, 2025
7ee696f
zig cc: Update intrinsic headers to Clang 20.
alexrp Feb 5, 2025
fe7f02e
libunwind: Update to LLVM 20.
alexrp Feb 5, 2025
6b33ec1
libcxxabi: Update to Clang 20.
alexrp Feb 5, 2025
115e87e
libcxx: Update to Clang 20.
alexrp Feb 5, 2025
b44413f
compiler: Updates for LLVM/Clang 20 API changes.
alexrp Feb 5, 2025
88bc20f
std.Target: Update CPU models/features for LLVM 20.
alexrp Feb 5, 2025
29e6672
std.Target: Bump baseline hexagon model to hexagonv68.
alexrp Mar 10, 2025
dbe5576
std.Target: Add Abi.muslf32 and Abi.muslsf.
alexrp Mar 10, 2025
a862fd8
zig cc: Update options data to Clang 20.
alexrp Feb 5, 2025
89b5a16
libtsan: Update to LLVM 20.
alexrp Feb 5, 2025
dd5b747
llvm: Set target-abi module flag.
alexrp Feb 12, 2025
3c1ca04
llvm: Fix i128 alignment for various targets.
alexrp Mar 5, 2025
8542bd4
compiler: Update max int alignments for some targets.
alexrp Mar 5, 2025
eb02ea9
llvm: Update the list of targets that use native f16/f128.
alexrp Mar 10, 2025
46ea23d
compiler-rt: Fix names of some float/int conversion routines for hexa…
alexrp Mar 5, 2025
ed6d241
Sema: Prevent tail calls of std.builtin.returnError().
alexrp Mar 6, 2025
467eec2
llvm: never_tail implies never_inline, so set noinline in this case too.
alexrp Mar 6, 2025
4e06bee
llvm: Allow FastISel on mips again.
alexrp Mar 10, 2025
ed1c54c
llvm: Use muslabin32/muslabi64 environments in the target triple.
alexrp Mar 10, 2025
2d07f0f
test: mips32 is no longer a slow target with LLVM 20.
alexrp Mar 9, 2025
0d662ea
Revert "test: Partially disable `vector float operators` on mips."
alexrp Mar 10, 2025
f9b94f2
std: Disable `link with relative paths` and `linkat with different di…
alexrp Mar 9, 2025
4952cff
llvm: Remove workaround for zero-length memset/memcpy on wasm.
alexrp Mar 10, 2025
ecafed1
Revert "glibc: Patch to work around missing features in LLVM's s390x …
alexrp Mar 10, 2025
1031ba9
zig cc: Avoid passing any "CPU" features related to float ABI to Clang.
alexrp Mar 10, 2025
aa81995
Compilation: Remove the PowerPC soft float preprocessor workaround.
alexrp Mar 10, 2025
8a189da
Revert "compiler: Don't consider powerpc to have red zone support yet."
alexrp Mar 10, 2025
2e48399
test: Disable aarch64_be module tests for now.
alexrp Mar 5, 2025
64bcbda
compiler-rt: Apply never_inline to std.math.ldexp() call in bigIntFro…
alexrp Mar 9, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
push:
branches:
- master
- llvm19
- llvm20
concurrency:
# Cancels pending runs when a PR gets updated.
group: ${{ github.head_ref || github.run_id }}-${{ github.actor }}
Expand Down
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,9 @@ else()
set(ZIG_SYSTEM_LIBCXX "stdc++" CACHE STRING "system libcxx name for build.zig")
endif()

find_package(llvm 19)
find_package(clang 19)
find_package(lld 19)
find_package(llvm 20)
find_package(clang 20)
find_package(lld 20)

if(ZIG_STATIC_ZLIB)
if (MSVC)
Expand Down
8 changes: 4 additions & 4 deletions cmake/Findclang.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ find_path(CLANG_INCLUDE_DIRS NAMES clang/Frontend/ASTUnit.h
if(${LLVM_LINK_MODE} STREQUAL "shared")
find_library(CLANG_LIBRARIES
NAMES
libclang-cpp.so.19
libclang-cpp.so.19.1
clang-cpp-19.0
clang-cpp190
libclang-cpp.so.20
libclang-cpp.so.20.1
clang-cpp-20.0
clang-cpp200
clang-cpp
NAMES_PER_DIR
HINTS "${LLVM_LIBDIRS}"
Expand Down
32 changes: 16 additions & 16 deletions cmake/Findlld.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,21 @@
find_path(LLD_INCLUDE_DIRS NAMES lld/Common/Driver.h
HINTS ${LLVM_INCLUDE_DIRS}
PATHS
/usr/lib/llvm-19/include
/usr/local/llvm190/include
/usr/local/llvm19/include
/usr/local/opt/llvm@19/include
/opt/homebrew/opt/llvm@19/include
/usr/lib/llvm-20/include
/usr/local/llvm200/include
/usr/local/llvm20/include
/usr/local/opt/llvm@20/include
/opt/homebrew/opt/llvm@20/include
/mingw64/include)

find_library(LLD_LIBRARY NAMES lld-19.0 lld190 lld NAMES_PER_DIR
find_library(LLD_LIBRARY NAMES lld-20.0 lld200 lld NAMES_PER_DIR
HINTS ${LLVM_LIBDIRS}
PATHS
/usr/lib/llvm-19/lib
/usr/local/llvm190/lib
/usr/local/llvm19/lib
/usr/local/opt/llvm@19/lib
/opt/homebrew/opt/llvm@19/lib
/usr/lib/llvm-20/lib
/usr/local/llvm200/lib
/usr/local/llvm20/lib
/usr/local/opt/llvm@20/lib
/opt/homebrew/opt/llvm@20/lib
)
if(EXISTS ${LLD_LIBRARY})
set(LLD_LIBRARIES ${LLD_LIBRARY})
Expand All @@ -34,11 +34,11 @@ else()
HINTS ${LLVM_LIBDIRS}
PATHS
${LLD_LIBDIRS}
/usr/lib/llvm-19/lib
/usr/local/llvm190/lib
/usr/local/llvm19/lib
/usr/local/opt/llvm@19/lib
/opt/homebrew/opt/llvm@19/lib
/usr/lib/llvm-20/lib
/usr/local/llvm200/lib
/usr/local/llvm20/lib
/usr/local/opt/llvm@20/lib
/opt/homebrew/opt/llvm@20/lib
/mingw64/lib
/c/msys64/mingw64/lib
c:/msys64/mingw64/lib)
Expand Down
12 changes: 6 additions & 6 deletions cmake/Findllvm.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ if(ZIG_USE_LLVM_CONFIG)
# terminate when the right LLVM version is not found.
unset(LLVM_CONFIG_EXE CACHE)
find_program(LLVM_CONFIG_EXE
NAMES llvm-config-19 llvm-config-19.0 llvm-config190 llvm-config19 llvm-config NAMES_PER_DIR
NAMES llvm-config-20 llvm-config-20.0 llvm-config200 llvm-config20 llvm-config NAMES_PER_DIR
PATHS
"/mingw64/bin"
"/c/msys64/mingw64/bin"
"c:/msys64/mingw64/bin"
"C:/Libraries/llvm-19.0.0/bin")
"C:/Libraries/llvm-20.0.0/bin")

if ("${LLVM_CONFIG_EXE}" STREQUAL "LLVM_CONFIG_EXE-NOTFOUND")
if (NOT LLVM_CONFIG_ERROR_MESSAGES STREQUAL "")
Expand All @@ -40,9 +40,9 @@ if(ZIG_USE_LLVM_CONFIG)
OUTPUT_STRIP_TRAILING_WHITESPACE)

get_filename_component(LLVM_CONFIG_DIR "${LLVM_CONFIG_EXE}" DIRECTORY)
if("${LLVM_CONFIG_VERSION}" VERSION_LESS 19 OR "${LLVM_CONFIG_VERSION}" VERSION_EQUAL 20 OR "${LLVM_CONFIG_VERSION}" VERSION_GREATER 20)
if("${LLVM_CONFIG_VERSION}" VERSION_LESS 20 OR "${LLVM_CONFIG_VERSION}" VERSION_EQUAL 21 OR "${LLVM_CONFIG_VERSION}" VERSION_GREATER 21)
# Save the error message, in case this is the last llvm-config we find
list(APPEND LLVM_CONFIG_ERROR_MESSAGES "expected LLVM 19.x but found ${LLVM_CONFIG_VERSION} using ${LLVM_CONFIG_EXE}")
list(APPEND LLVM_CONFIG_ERROR_MESSAGES "expected LLVM 20.x but found ${LLVM_CONFIG_VERSION} using ${LLVM_CONFIG_EXE}")

# Ignore this directory and try the search again
list(APPEND CMAKE_IGNORE_PATH "${LLVM_CONFIG_DIR}")
Expand All @@ -66,9 +66,9 @@ if(ZIG_USE_LLVM_CONFIG)
if (LLVM_CONFIG_ERROR)
# Save the error message, in case this is the last llvm-config we find
if (ZIG_SHARED_LLVM)
list(APPEND LLVM_CONFIG_ERROR_MESSAGES "LLVM 19.x found at ${LLVM_CONFIG_EXE} does not support linking as a shared library")
list(APPEND LLVM_CONFIG_ERROR_MESSAGES "LLVM 20.x found at ${LLVM_CONFIG_EXE} does not support linking as a shared library")
else()
list(APPEND LLVM_CONFIG_ERROR_MESSAGES "LLVM 19.x found at ${LLVM_CONFIG_EXE} does not support linking as a static library")
list(APPEND LLVM_CONFIG_ERROR_MESSAGES "LLVM 20.x found at ${LLVM_CONFIG_EXE} does not support linking as a static library")
endif()

# Ignore this directory and try the search again
Expand Down
2 changes: 2 additions & 0 deletions lib/compiler/aro/aro/target.zig
Original file line number Diff line number Diff line change
Expand Up @@ -698,6 +698,8 @@ pub fn toLLVMTriple(target: std.Target, buf: []u8) []const u8 {
.muslabi64 => "muslabi64",
.musleabi => "musleabi",
.musleabihf => "musleabihf",
.muslf32 => "muslf32",
.muslsf => "muslsf",
.muslx32 => "muslx32",
.msvc => "msvc",
.itanium => "itanium",
Expand Down
30 changes: 17 additions & 13 deletions lib/compiler_rt/common.zig
Original file line number Diff line number Diff line change
Expand Up @@ -96,21 +96,25 @@ pub const want_sparc_abi = builtin.cpu.arch.isSPARC();
// we're trying to test compiler-rt.
pub const panic = if (builtin.is_test) std.debug.FullPanic(std.debug.defaultPanic) else std.debug.no_panic;

/// AArch64 is the only ABI (at the moment) to support f16 arguments without the
/// need for extending them to wider fp types.
/// TODO remove this; do this type selection in the language rather than
/// here in compiler-rt.
/// This seems to mostly correspond to `clang::TargetInfo::HasFloat16`.
pub fn F16T(comptime OtherType: type) type {
return switch (builtin.cpu.arch) {
.arm, .armeb, .thumb, .thumbeb => if (std.Target.arm.featureSetHas(builtin.cpu.features, .has_v8))
switch (builtin.abi.float()) {
.soft => u16,
.hard => f16,
}
else
u16,
.aarch64, .aarch64_be => f16,
.riscv32, .riscv64 => f16,
.amdgcn,
.arm,
.armeb,
.thumb,
.thumbeb,
.aarch64,
.aarch64_be,
.nvptx,
.nvptx64,
.riscv32,
.riscv64,
.spirv,
.spirv32,
.spirv64,
=> f16,
.hexagon => if (std.Target.hexagon.featureSetHas(builtin.target.cpu.features, .v68)) f16 else u16,
.x86, .x86_64 => if (builtin.target.os.tag.isDarwin()) switch (OtherType) {
// Starting with LLVM 16, Darwin uses different abi for f16
// depending on the type of the other return/argument..???
Expand Down
5 changes: 1 addition & 4 deletions lib/compiler_rt/fixdfti.zig
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@ comptime {
if (common.want_windows_v2u64_abi) {
@export(&__fixdfti_windows_x86_64, .{ .name = "__fixdfti", .linkage = common.linkage, .visibility = common.visibility });
} else {
@export(&__fixdfti, .{ .name = switch (builtin.cpu.arch) {
.hexagon => "__hexagon",
else => "_",
} ++ "_fixdfti", .linkage = common.linkage, .visibility = common.visibility });
@export(&__fixdfti, .{ .name = "__fixdfti", .linkage = common.linkage, .visibility = common.visibility });
}
}

Expand Down
5 changes: 1 addition & 4 deletions lib/compiler_rt/fixsfti.zig
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@ comptime {
if (common.want_windows_v2u64_abi) {
@export(&__fixsfti_windows_x86_64, .{ .name = "__fixsfti", .linkage = common.linkage, .visibility = common.visibility });
} else {
@export(&__fixsfti, .{ .name = switch (builtin.cpu.arch) {
.hexagon => "__hexagon",
else => "_",
} ++ "_fixsfti", .linkage = common.linkage, .visibility = common.visibility });
@export(&__fixsfti, .{ .name = "__fixsfti", .linkage = common.linkage, .visibility = common.visibility });
}
}

Expand Down
5 changes: 1 addition & 4 deletions lib/compiler_rt/fixunsdfti.zig
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@ comptime {
if (common.want_windows_v2u64_abi) {
@export(&__fixunsdfti_windows_x86_64, .{ .name = "__fixunsdfti", .linkage = common.linkage, .visibility = common.visibility });
} else {
@export(&__fixunsdfti, .{ .name = switch (builtin.cpu.arch) {
.hexagon => "__hexagon",
else => "_",
} ++ "_fixunsdfti", .linkage = common.linkage, .visibility = common.visibility });
@export(&__fixunsdfti, .{ .name = "__fixunsdfti", .linkage = common.linkage, .visibility = common.visibility });
}
}

Expand Down
5 changes: 1 addition & 4 deletions lib/compiler_rt/fixunssfti.zig
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@ comptime {
if (common.want_windows_v2u64_abi) {
@export(&__fixunssfti_windows_x86_64, .{ .name = "__fixunssfti", .linkage = common.linkage, .visibility = common.visibility });
} else {
@export(&__fixunssfti, .{ .name = switch (builtin.cpu.arch) {
.hexagon => "__hexagon",
else => "_",
} ++ "_fixunssfti", .linkage = common.linkage, .visibility = common.visibility });
@export(&__fixunssfti, .{ .name = "__fixunssfti", .linkage = common.linkage, .visibility = common.visibility });
}
}

Expand Down
5 changes: 1 addition & 4 deletions lib/compiler_rt/floattidf.zig
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@ comptime {
if (common.want_windows_v2u64_abi) {
@export(&__floattidf_windows_x86_64, .{ .name = "__floattidf", .linkage = common.linkage, .visibility = common.visibility });
} else {
@export(&__floattidf, .{ .name = switch (builtin.cpu.arch) {
.hexagon => "__hexagon",
else => "_",
} ++ "_floattidf", .linkage = common.linkage, .visibility = common.visibility });
@export(&__floattidf, .{ .name = "__floattidf", .linkage = common.linkage, .visibility = common.visibility });
}
}

Expand Down
5 changes: 1 addition & 4 deletions lib/compiler_rt/floattisf.zig
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@ comptime {
if (common.want_windows_v2u64_abi) {
@export(&__floattisf_windows_x86_64, .{ .name = "__floattisf", .linkage = common.linkage, .visibility = common.visibility });
} else {
@export(&__floattisf, .{ .name = switch (builtin.cpu.arch) {
.hexagon => "__hexagon",
else => "_",
} ++ "_floattisf", .linkage = common.linkage, .visibility = common.visibility });
@export(&__floattisf, .{ .name = "__floattisf", .linkage = common.linkage, .visibility = common.visibility });
}
}

Expand Down
2 changes: 1 addition & 1 deletion lib/compiler_rt/int_from_float.zig
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ pub inline fn bigIntFromFloat(comptime signedness: std.builtin.Signedness, resul
const exponent = @max(parts.exponent - significand_bits_adjusted_to_handle_smin, 0);
const int: I = @intFromFloat(switch (exponent) {
0 => a,
else => math.ldexp(parts.significand, significand_bits_adjusted_to_handle_smin),
else => @call(.never_inline, math.ldexp, .{ parts.significand, significand_bits_adjusted_to_handle_smin }), // https://github.com/llvm/llvm-project/issues/130408
});
switch (signedness) {
.signed => {
Expand Down
5 changes: 5 additions & 0 deletions lib/include/adcintrin.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,12 @@
#endif

/* Define the default attributes for the functions in this file. */
#if defined(__cplusplus) && (__cplusplus >= 201103L)
#define __DEFAULT_FN_ATTRS \
__attribute__((__always_inline__, __nodebug__)) constexpr
#else
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__))
#endif

/* Use C++ inline semantics in C++, GNU inline for C mode. */
#if defined(__cplusplus)
Expand Down
5 changes: 5 additions & 0 deletions lib/include/adxintrin.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,13 @@
#define __ADXINTRIN_H

/* Define the default attributes for the functions in this file. */
#if defined(__cplusplus) && (__cplusplus >= 201103L)
#define __DEFAULT_FN_ATTRS \
__attribute__((__always_inline__, __nodebug__, __target__("adx"))) constexpr
#else
#define __DEFAULT_FN_ATTRS \
__attribute__((__always_inline__, __nodebug__, __target__("adx")))
#endif

/* Use C++ inline semantics in C++, GNU inline for C mode. */
#if defined(__cplusplus)
Expand Down
16 changes: 8 additions & 8 deletions lib/include/altivec.h
Original file line number Diff line number Diff line change
Expand Up @@ -2502,37 +2502,37 @@ vec_cmplt(vector unsigned long long __a, vector unsigned long long __b) {

static __inline__ vector unsigned char __ATTRS_o_ai
vec_popcnt(vector signed char __a) {
return (vector unsigned char)__builtin_altivec_vpopcntb(
return (vector unsigned char)__builtin_elementwise_popcount(
(vector unsigned char)__a);
}
static __inline__ vector unsigned char __ATTRS_o_ai
vec_popcnt(vector unsigned char __a) {
return __builtin_altivec_vpopcntb(__a);
return __builtin_elementwise_popcount(__a);
}
static __inline__ vector unsigned short __ATTRS_o_ai
vec_popcnt(vector signed short __a) {
return (vector unsigned short)__builtin_altivec_vpopcnth(
return (vector unsigned short)__builtin_elementwise_popcount(
(vector unsigned short)__a);
}
static __inline__ vector unsigned short __ATTRS_o_ai
vec_popcnt(vector unsigned short __a) {
return __builtin_altivec_vpopcnth(__a);
return __builtin_elementwise_popcount(__a);
}
static __inline__ vector unsigned int __ATTRS_o_ai
vec_popcnt(vector signed int __a) {
return __builtin_altivec_vpopcntw((vector unsigned int)__a);
return __builtin_elementwise_popcount((vector unsigned int)__a);
}
static __inline__ vector unsigned int __ATTRS_o_ai
vec_popcnt(vector unsigned int __a) {
return __builtin_altivec_vpopcntw(__a);
return __builtin_elementwise_popcount(__a);
}
static __inline__ vector unsigned long long __ATTRS_o_ai
vec_popcnt(vector signed long long __a) {
return __builtin_altivec_vpopcntd((vector unsigned long long)__a);
return __builtin_elementwise_popcount((vector unsigned long long)__a);
}
static __inline__ vector unsigned long long __ATTRS_o_ai
vec_popcnt(vector unsigned long long __a) {
return __builtin_altivec_vpopcntd(__a);
return __builtin_elementwise_popcount(__a);
}

#define vec_vclz vec_cntlz
Expand Down
Loading
Loading