Skip to content

Commit 1ad232c

Browse files
committed
Merge branch 'llvm19'
2 parents 2ef7215 + 6837289 commit 1ad232c

File tree

5,953 files changed

+518070
-318284
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

5,953 files changed

+518070
-318284
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ end with a fully operational Zig compiler for any target.
88
This repository copies sources from upstream. Patches listed below. Use git
99
to find and inspect the patch diffs.
1010

11-
* LLVM, LLD, Clang 18.1.8
11+
* LLVM, LLD, Clang 19.1.0
1212
* zlib 1.3.1
1313
* zstd 1.5.2
14-
* zig 0.14.0-dev.1294+df6907f60
14+
* zig 0.14.0-dev.1622+2ac543388
1515

1616
For other versions, check the git tags of this repository.
1717

@@ -24,6 +24,7 @@ For other versions, check the git tags of this repository.
2424
* LLD: Added additional include directory to Zig's libunwind.
2525
* LLD: Respect `LLD_BUILD_TOOLS=OFF`
2626
* zlib: Delete the ability to build a shared library.
27+
* [LLVM: Fix crash when FREEZE a half(f16) type on loongarch](https://github.com/llvm/llvm-project/pull/107791)
2728

2829
## Host System Dependencies
2930

build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ TARGET="$1" # Example: riscv64-linux-gnu
77
MCPU="$2" # Examples: `baseline`, `native`, `generic+v7a`, or `arm1176jzf_s`
88

99
ROOTDIR="$(pwd)"
10-
ZIG_VERSION="0.14.0-dev.1294+df6907f60"
10+
ZIG_VERSION="0.14.0-dev.1622+2ac543388"
1111

1212
TARGET_OS_AND_ABI=${TARGET#*-} # Example: linux-gnu
1313

build.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ if "%VSCMD_ARG_HOST_ARCH%"=="x86" set OUTDIR=out-win-x86
3535

3636
set ROOTDIR=%~dp0
3737
set "ROOTDIR_CMAKE=%ROOTDIR:\=/%"
38-
set ZIG_VERSION="0.14.0-dev.1294+df6907f60"
38+
set ZIG_VERSION="0.14.0-dev.1622+2ac543388"
3939
set JOBS_ARG=
4040

4141
pushd %ROOTDIR%

clang/CMakeLists.txt

Lines changed: 68 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
cmake_minimum_required(VERSION 3.20.0)
2+
set(LLVM_SUBPROJECT_TITLE "Clang")
23

34
if(NOT DEFINED LLVM_COMMON_CMAKE_UTILS)
45
set(LLVM_COMMON_CMAKE_UTILS ${CMAKE_CURRENT_SOURCE_DIR}/../cmake)
@@ -13,8 +14,16 @@ if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
1314
set(CLANG_BUILT_STANDALONE TRUE)
1415
endif()
1516

17+
# Make sure that our source directory is on the current cmake module path so that
18+
# we can include cmake files from this directory.
19+
list(INSERT CMAKE_MODULE_PATH 0
20+
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules"
21+
"${LLVM_COMMON_CMAKE_UTILS}/Modules"
22+
)
23+
1624
# Must go below project(..)
1725
include(GNUInstallDirs)
26+
include(GetDarwinLinkerVersion)
1827

1928
if(CLANG_BUILT_STANDALONE)
2029
set(CMAKE_CXX_STANDARD 17 CACHE STRING "C++ standard to conform to")
@@ -140,13 +149,6 @@ if(CLANG_BUILT_STANDALONE)
140149
endif() # LLVM_INCLUDE_TESTS
141150
endif() # standalone
142151

143-
# Make sure that our source directory is on the current cmake module path so that
144-
# we can include cmake files from this directory.
145-
list(INSERT CMAKE_MODULE_PATH 0
146-
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules"
147-
"${LLVM_COMMON_CMAKE_UTILS}/Modules"
148-
)
149-
150152
# This allows disabling clang's XML dependency even if LLVM finds libxml2.
151153
# By default, clang depends on libxml2 if LLVM does.
152154
option(CLANG_ENABLE_LIBXML2 "Whether libclang may depend on libxml2"
@@ -164,6 +166,17 @@ if(CLANG_ENABLE_LIBXML2)
164166
endif()
165167
endif()
166168

169+
if(CLANG_ENABLE_CIR)
170+
if (CLANG_BUILT_STANDALONE)
171+
message(FATAL_ERROR
172+
"ClangIR is not yet supported in the standalone build.")
173+
endif()
174+
if (NOT "${LLVM_ENABLE_PROJECTS}" MATCHES "MLIR|mlir")
175+
message(FATAL_ERROR
176+
"Cannot build ClangIR without MLIR in LLVM_ENABLE_PROJECTS")
177+
endif()
178+
endif()
179+
167180
include(CheckIncludeFile)
168181
check_include_file(sys/resource.h CLANG_HAVE_RLIMITS)
169182

@@ -190,11 +203,12 @@ set(CLANG_RESOURCE_DIR "" CACHE STRING
190203
set(C_INCLUDE_DIRS "" CACHE STRING
191204
"Colon separated list of directories clang will search for headers.")
192205

206+
set(USE_DEPRECATED_GCC_INSTALL_PREFIX OFF CACHE BOOL "Temporary workaround before GCC_INSTALL_PREFIX is completely removed")
193207
set(GCC_INSTALL_PREFIX "" CACHE PATH "Directory where gcc is installed." )
194208
set(DEFAULT_SYSROOT "" CACHE STRING
195209
"Default <path> to all compiler invocations for --sysroot=<path>." )
196-
if(GCC_INSTALL_PREFIX)
197-
message(WARNING "GCC_INSTALL_PREFIX is deprecated and will be removed. Use "
210+
if(GCC_INSTALL_PREFIX AND NOT USE_DEPRECATED_GCC_INSTALL_PREFIX)
211+
message(FATAL_ERROR "GCC_INSTALL_PREFIX is deprecated and will be removed. Use "
198212
"configuration files (https://clang.llvm.org/docs/UsersManual.html#configuration-files)"
199213
"to specify the default --gcc-install-dir= or --gcc-triple=. --gcc-toolchain= is discouraged. "
200214
"See https://github.com/llvm/llvm-project/pull/77537 for detail.")
@@ -336,29 +350,15 @@ if (LLVM_COMPILER_IS_GCC_COMPATIBLE)
336350
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Wno-long-long")
337351
endif ()
338352

339-
check_cxx_compiler_flag("-Werror -Wnested-anon-types" CXX_SUPPORTS_NO_NESTED_ANON_TYPES_FLAG)
340-
if( CXX_SUPPORTS_NO_NESTED_ANON_TYPES_FLAG )
353+
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
341354
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-nested-anon-types" )
342-
endif()
355+
endif ()
343356
endif ()
344357

345358
# Determine HOST_LINK_VERSION on Darwin.
346359
set(HOST_LINK_VERSION)
347360
if (APPLE AND NOT CMAKE_LINKER MATCHES ".*lld.*")
348-
set(LD_V_OUTPUT)
349-
execute_process(
350-
COMMAND sh -c "${CMAKE_LINKER} -v 2>&1 | head -1"
351-
RESULT_VARIABLE HAD_ERROR
352-
OUTPUT_VARIABLE LD_V_OUTPUT
353-
)
354-
if (HAD_ERROR)
355-
message(FATAL_ERROR "${CMAKE_LINKER} failed with status ${HAD_ERROR}")
356-
endif()
357-
if ("${LD_V_OUTPUT}" MATCHES ".*ld64-([0-9.]+).*")
358-
string(REGEX REPLACE ".*ld64-([0-9.]+).*" "\\1" HOST_LINK_VERSION ${LD_V_OUTPUT})
359-
elseif ("${LD_V_OUTPUT}" MATCHES "[^0-9]*([0-9.]+).*")
360-
string(REGEX REPLACE "[^0-9]*([0-9.]+).*" "\\1" HOST_LINK_VERSION ${LD_V_OUTPUT})
361-
endif()
361+
get_darwin_linker_version(HOST_LINK_VERSION)
362362
message(STATUS "Host linker version: ${HOST_LINK_VERSION}")
363363
endif()
364364

@@ -394,14 +394,15 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
394394
# Installing the headers needs to depend on generating any public
395395
# tablegen'd headers.
396396
add_custom_target(clang-headers DEPENDS clang-tablegen-targets)
397-
set_target_properties(clang-headers PROPERTIES FOLDER "Misc")
397+
set_target_properties(clang-headers PROPERTIES FOLDER "Clang/Resources")
398398
if(NOT LLVM_ENABLE_IDE)
399399
add_llvm_install_targets(install-clang-headers
400400
DEPENDS clang-headers
401401
COMPONENT clang-headers)
402402
endif()
403403

404404
add_custom_target(bash-autocomplete DEPENDS utils/bash-autocomplete.sh)
405+
set_target_properties(bash-autocomplete PROPERTIES FOLDER "Clang/Misc")
405406
install(FILES utils/bash-autocomplete.sh
406407
DESTINATION "${CMAKE_INSTALL_DATADIR}/clang"
407408
COMPONENT bash-autocomplete)
@@ -482,7 +483,7 @@ add_custom_target(clang-tablegen-targets
482483
omp_gen
483484
ClangDriverOptions
484485
${CLANG_TABLEGEN_TARGETS})
485-
set_target_properties(clang-tablegen-targets PROPERTIES FOLDER "Misc")
486+
set_target_properties(clang-tablegen-targets PROPERTIES FOLDER "Clang/Tablegenning/Targets")
486487
list(APPEND LLVM_COMMON_DEPENDS clang-tablegen-targets)
487488

488489
# Force target to be built as soon as possible. Clang modules builds depend
@@ -522,6 +523,8 @@ endif()
522523

523524

524525
if( CLANG_INCLUDE_TESTS )
526+
find_package(Perl)
527+
525528
add_subdirectory(unittests)
526529
list(APPEND CLANG_TEST_DEPS ClangUnitTests)
527530
list(APPEND CLANG_TEST_PARAMS
@@ -544,7 +547,7 @@ endif()
544547

545548
# Custom target to install all clang libraries.
546549
add_custom_target(clang-libraries)
547-
set_target_properties(clang-libraries PROPERTIES FOLDER "Misc")
550+
set_target_properties(clang-libraries PROPERTIES FOLDER "Clang/Install")
548551

549552
if(NOT LLVM_ENABLE_IDE)
550553
add_llvm_install_targets(install-clang-libraries
@@ -846,23 +849,17 @@ if (CLANG_ENABLE_BOOTSTRAP)
846849
set(CLANG_BOOTSTRAP_TARGETS check-llvm check-clang check-all)
847850
endif()
848851
foreach(target ${CLANG_BOOTSTRAP_TARGETS})
849-
# Install targets have side effects, so we always want to execute them.
850-
# "install" is reserved by CMake and can't be used as a step name for
851-
# ExternalProject_Add_Step, so we can match against "^install-" instead of
852-
# "^install" to get a tighter match. CMake's installation scripts already
853-
# skip up-to-date files, so there's no behavior change if you install to the
854-
# same destination multiple times.
855-
if(target MATCHES "^install-")
856-
set(step_always ON)
857-
else()
858-
set(step_always OFF)
859-
endif()
860852

861853
ExternalProject_Add_Step(${NEXT_CLANG_STAGE} ${target}
862854
COMMAND ${CMAKE_COMMAND} --build <BINARY_DIR> --target ${target}
863855
COMMENT "Performing ${target} for '${NEXT_CLANG_STAGE}'"
864856
DEPENDEES configure
865-
ALWAYS ${step_always}
857+
# We need to set ALWAYS to ON here, otherwise these targets won't be
858+
# built on a second invocation of ninja. The targets have their own
859+
# logic to determine if they should build or not so setting ALWAYS ON
860+
# here does not mean the targets will always rebuild it just means that
861+
# they will check their dependenices and see if they need to be built.
862+
ALWAYS ON
866863
EXCLUDE_FROM_MAIN ON
867864
USES_TERMINAL 1
868865
)
@@ -875,23 +872,38 @@ if (CLANG_ENABLE_BOOTSTRAP)
875872
endforeach()
876873
endif()
877874

878-
if (CLANG_BOLT_INSTRUMENT AND NOT LLVM_BUILD_INSTRUMENTED)
875+
set(CLANG_BOLT OFF CACHE STRING "Apply BOLT optimization to Clang. \
876+
May be specified as Instrument or Perf or LBR to use a particular profiling \
877+
mechanism.")
878+
string(TOUPPER "${CLANG_BOLT}" CLANG_BOLT)
879+
880+
if (CLANG_BOLT AND NOT LLVM_BUILD_INSTRUMENTED)
879881
set(CLANG_PATH ${LLVM_RUNTIME_OUTPUT_INTDIR}/clang)
880-
set(CLANG_INSTRUMENTED ${CLANG_PATH}-bolt.inst)
882+
set(CLANG_INSTRUMENTED ${LLVM_RUNTIME_OUTPUT_INTDIR}/${CLANG_BOLT_INSTRUMENTED})
881883
set(BOLT_FDATA ${CMAKE_CURRENT_BINARY_DIR}/utils/perf-training/prof.fdata)
882884

883-
# Instrument clang with BOLT
884-
add_custom_target(clang-instrumented
885-
DEPENDS ${CLANG_INSTRUMENTED}
886-
)
887-
add_custom_command(OUTPUT ${CLANG_INSTRUMENTED}
888-
DEPENDS clang llvm-bolt
889-
COMMAND llvm-bolt ${CLANG_PATH} -o ${CLANG_INSTRUMENTED}
890-
-instrument --instrumentation-file-append-pid
891-
--instrumentation-file=${BOLT_FDATA}
892-
COMMENT "Instrumenting clang binary with BOLT"
893-
VERBATIM
894-
)
885+
# Pass extra flag in no-LBR mode
886+
if (CLANG_BOLT STREQUAL "PERF")
887+
set(BOLT_NO_LBR "-nl")
888+
endif()
889+
890+
if (CLANG_BOLT STREQUAL "INSTRUMENT")
891+
# Instrument clang with BOLT
892+
add_custom_target(clang-instrumented
893+
DEPENDS ${CLANG_INSTRUMENTED}
894+
)
895+
add_custom_command(OUTPUT ${CLANG_INSTRUMENTED}
896+
DEPENDS clang llvm-bolt
897+
COMMAND llvm-bolt ${CLANG_PATH} -o ${CLANG_INSTRUMENTED}
898+
-instrument --instrumentation-file-append-pid
899+
--instrumentation-file=${BOLT_FDATA}
900+
COMMENT "Instrumenting clang binary with BOLT"
901+
VERBATIM
902+
)
903+
add_custom_target(clang-bolt-training-deps DEPENDS clang-instrumented)
904+
else() # perf or LBR
905+
add_custom_target(clang-bolt-training-deps DEPENDS clang)
906+
endif()
895907

896908
# Optimize original (pre-bolt) Clang using the collected profile
897909
set(CLANG_OPTIMIZED ${CMAKE_CURRENT_BINARY_DIR}/clang.bolt)
@@ -905,6 +917,7 @@ if (CLANG_BOLT_INSTRUMENT AND NOT LLVM_BUILD_INSTRUMENTED)
905917
-data ${BOLT_FDATA}
906918
-reorder-blocks=ext-tsp -reorder-functions=hfsort+ -split-functions
907919
-split-all-cold -split-eh -dyno-stats -icf=1 -use-gnu-stack
920+
${BOLT_NO_LBR}
908921
COMMAND ${CMAKE_COMMAND} -E rename ${CLANG_OPTIMIZED} $<TARGET_FILE:clang>
909922
COMMENT "Optimizing Clang with BOLT"
910923
VERBATIM

clang/README.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ on the Clang forums:
2323
https://discourse.llvm.org/c/clang/
2424

2525
If you find a bug in Clang, please file it in the LLVM bug tracker:
26-
http://llvm.org/bugs/
26+
https://github.com/llvm/llvm-project/issues

clang/bindings/python/README.txt

Lines changed: 0 additions & 18 deletions
This file was deleted.

clang/bindings/python/clang/__init__.py

Lines changed: 0 additions & 22 deletions
This file was deleted.

0 commit comments

Comments
 (0)