Skip to content

Commit 81ad30f

Browse files
committed
Merge branch 'upstream' into x86-extractelt-shuffle-cost
2 parents 1c94190 + eaa5897 commit 81ad30f

File tree

355 files changed

+21827
-2372
lines changed

Some content is hidden

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

355 files changed

+21827
-2372
lines changed

.github/workflows/premerge.yaml

Lines changed: 63 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
if: github.repository_owner == 'llvm'
1717
runs-on: llvm-premerge-linux-runners
1818
concurrency:
19-
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
19+
group: ${{ github.workflow }}-linux-${{ github.event.pull_request.number || github.sha }}
2020
cancel-in-progress: true
2121
steps:
2222
- name: Checkout LLVM
@@ -70,3 +70,65 @@ jobs:
7070
export CXX=/opt/llvm/bin/clang++
7171
7272
./.ci/monolithic-linux.sh "$(echo ${linux_projects} | tr ' ' ';')" "$(echo ${linux_check_targets})" "$(echo ${linux_runtimes} | tr ' ' ';')" "$(echo ${linux_runtime_check_targets})"
73+
74+
premerge-checks-windows:
75+
if: github.repository_owner == 'llvm'
76+
runs-on: llvm-premerge-windows-runners
77+
concurrency:
78+
group: ${{ github.workflow }}-windows-${{ github.event.pull_request.number || github.sha }}
79+
cancel-in-progress: true
80+
defaults:
81+
run:
82+
shell: bash
83+
steps:
84+
- name: Checkout LLVM
85+
uses: actions/checkout@v4
86+
with:
87+
fetch-depth: 2
88+
- name: Setup ccache
89+
uses: hendrikmuhs/[email protected]
90+
with:
91+
variant: "sccache"
92+
max-size: "2000M"
93+
- name: Compute Projects
94+
id: vars
95+
run: |
96+
modified_files=$(git diff --name-only HEAD~1...HEAD)
97+
modified_dirs=$(echo "$modified_files" | cut -d'/' -f1 | sort | uniq)
98+
99+
echo $modified_files
100+
echo $modified_dirs
101+
102+
. ./.ci/compute-projects.sh
103+
104+
all_projects="bolt clang clang-tools-extra compiler-rt cross-project-tests flang libc libclc lld lldb llvm mlir openmp polly pstl"
105+
modified_projects="$(keep-modified-projects ${all_projects})"
106+
107+
windows_projects_to_test=$(exclude-windows $(compute-projects-to-test 1 ${modified_projects}))
108+
windows_check_targets=$(check-targets ${windows_projects_to_test} | sort | uniq | tr -d '\r' | tr '\n' ' ')
109+
windows_projects=$(add-dependencies ${windows_projects_to_test} | sort | uniq | tr -d '\r' | tr '\n' ';')
110+
111+
if [[ "${windows_projects}" == "" ]]; then
112+
echo "No projects to build"
113+
fi
114+
115+
echo "Building projects: ${windows_projects}"
116+
echo "Running project checks targets: ${windows_check_targets}"
117+
118+
echo "windows-projects=${windows_projects}" >> $GITHUB_OUTPUT
119+
echo "windows-check-targets=${windows_check_targets}" >> $GITHUB_OUTPUT
120+
- name: Build and Test
121+
# Mark the job as a success even if the step fails so that people do
122+
# not get notified while the new premerge pipeline is in an
123+
# experimental state.
124+
# TODO(boomanaiden154): Remove this once the pipeline is stable and we
125+
# are ready for people to start recieving notifications.
126+
continue-on-error: true
127+
if: ${{ steps.vars.outputs.windows-projects != '' }}
128+
shell: cmd
129+
run: |
130+
set MAX_PARALLEL_COMPILE_JOBS=64
131+
set MAX_PARALLEL_LINK_JOBS=64
132+
call C:\\BuildTools\\Common7\\Tools\\VsDevCmd.bat -arch=amd64 -host_arch=amd64
133+
bash .ci/monolithic-windows.sh "${{ steps.vars.outputs.windows-projects }}" "${{ steps.vars.outputs.windows-check-targets }}"
134+

.github/workflows/release-binaries-all.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ jobs:
8383
matrix:
8484
runs-on:
8585
- ubuntu-22.04
86+
- ubuntu-22.04-arm
8687
- macos-13
8788
- macos-14
8889

.github/workflows/release-binaries.yml

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ on:
1818
type: choice
1919
options:
2020
- ubuntu-22.04
21+
- ubuntu-22.04-arm
2122
- macos-13
2223
- macos-14
2324

@@ -55,6 +56,7 @@ jobs:
5556
ref: ${{ steps.vars.outputs.ref }}
5657
upload: ${{ steps.vars.outputs.upload }}
5758
target-cmake-flags: ${{ steps.vars.outputs.target-cmake-flags }}
59+
ccache: ${{ steps.vars.outputs.ccache }}
5860
build-flang: ${{ steps.vars.outputs.build-flang }}
5961
enable-pgo: ${{ steps.vars.outputs.enable-pgo }}
6062
release-binary-basename: ${{ steps.vars.outputs.release-binary-basename }}
@@ -119,8 +121,16 @@ jobs:
119121
echo "release-binary-basename=$release_binary_basename" >> $GITHUB_OUTPUT
120122
echo "release-binary-filename=$release_binary_basename.tar.xz" >> $GITHUB_OUTPUT
121123
122-
# Detect necessary CMake flags
123124
target="$RUNNER_OS-$RUNNER_ARCH"
125+
# The hendrikmuhs/ccache-action action does not support installing sccache
126+
# on arm64 Linux.
127+
if [ "$target" = "Linux-ARM64" ]; then
128+
echo ccache=ccache >> $GITHUB_OUTPUT
129+
else
130+
echo ccache=sccache >> $GITHUB_OUTPUT
131+
fi
132+
133+
# Detect necessary CMake flags
124134
echo "enable-pgo=false" >> $GITHUB_OUTPUT
125135
target_cmake_flags="-DLLVM_RELEASE_ENABLE_PGO=OFF"
126136
# The macOS builds try to cross compile some libraries so we need to
@@ -146,7 +156,7 @@ jobs:
146156
echo "target-cmake-flags=$target_cmake_flags" >> $GITHUB_OUTPUT
147157
echo "build-flang=$build_flang" >> $GITHUB_OUTPUT
148158
case "${{ inputs.runs-on }}" in
149-
ubuntu-22.04)
159+
ubuntu-22.04*)
150160
build_runs_on="depot-${{ inputs.runs-on }}-16"
151161
test_runs_on=$build_runs_on
152162
;;
@@ -221,12 +231,14 @@ jobs:
221231
with:
222232
# Default to 2G to workaround: https://github.com/hendrikmuhs/ccache-action/issues/174
223233
max-size: 2G
224-
key: sccache-${{ runner.os }}-${{ runner.arch }}-release
225-
variant: sccache
234+
key: ${{ needs.prepare.outputs.ccache }}-${{ runner.os }}-${{ runner.arch }}-release
235+
variant: ${{ needs.prepare.outputs.ccache }}
226236

227237
- name: Configure
228238
id: build
229239
shell: bash
240+
env:
241+
CCACHE_BIN: ${{ needs.prepare.outputs.ccache }}
230242
run: |
231243
# There were some issues on the ARM64 MacOS runners with trying to build x86 object,
232244
# so we need to set some extra cmake flags to disable this.
@@ -235,8 +247,8 @@ jobs:
235247
-C clang/cmake/caches/Release.cmake \
236248
-DBOOTSTRAP_LLVM_PARALLEL_LINK_JOBS=1 \
237249
-DBOOTSTRAP_CPACK_PACKAGE_FILE_NAME="${{ needs.prepare.outputs.release-binary-basename }}" \
238-
-DCMAKE_C_COMPILER_LAUNCHER=sccache \
239-
-DCMAKE_CXX_COMPILER_LAUNCHER=sccache
250+
-DCMAKE_C_COMPILER_LAUNCHER=$CCACHE_BIN \
251+
-DCMAKE_CXX_COMPILER_LAUNCHER=$CCACHE_BIN
240252
- name: Build
241253
shell: bash
242254
run: |

clang/docs/ReleaseNotes.rst

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,7 @@ C Language Changes
387387
------------------
388388

389389
- Extend clang's ``<limits.h>`` to define ``LONG_LONG_*`` macros for Android's bionic.
390+
- Macro ``__STDC_NO_THREADS__`` is no longer necessary for MSVC 2022 1939 and later.
390391

391392
C2y Feature Support
392393
^^^^^^^^^^^^^^^^^^^
@@ -479,6 +480,17 @@ Non-comprehensive list of changes in this release
479480
``__builtin_elementwise_sub_sat``, ``__builtin_reduce_min`` (For integral element type),
480481
``__builtin_reduce_max`` (For integral element type).
481482

483+
- The builtin macros ``__INT8_C``, ``__INT16_C``, ``__INT32_C``, ``__INT64_C``,
484+
``__INTMAX_C``, ``__UINT8_C``, ``__UINT16_C``, ``__UINT32_C``, ``__UINT64_C``
485+
and ``__UINTMAX_C`` have been introduced to ease the implementaton of section
486+
7.18.4 of ISO/IEC 9899:1999. These macros are also defined by GCC and should
487+
be used instead of others that expand and paste the suffixes provided by
488+
``__INT8_C_SUFFIX__``, ``__INT16_C_SUFFIX__``, ``__INT32_C_SUFFIX__``,
489+
``__INT64_C_SUFFIX__``, ``__INTMAX_C_SUFFIX__``, ``__UINT8_C_SUFFIX__``,
490+
``__UINT16_C_SUFFIX__``, ``__UINT32_C_SUFFIX__``, ``__UINT64_C_SUFFIX__`` and
491+
``__UINTMAX_C_SUFFIX__``. Pasting suffixes after the expansion of their
492+
respective macros is unsafe, as users can define the suffixes as macros.
493+
482494
- Clang now rejects ``_BitInt`` matrix element types if the bit width is less than ``CHAR_WIDTH`` or
483495
not a power of two, matching preexisting behaviour for vector types.
484496

@@ -991,6 +1003,9 @@ Bug Fixes to C++ Support
9911003
- Fixed assertions or false compiler diagnostics in the case of C++ modules for
9921004
lambda functions or inline friend functions defined inside templates (#GH122493).
9931005
- Clang now rejects declaring an alias template with the same name as its template parameter. (#GH123423)
1006+
- Fix type of expression when calling a template which returns an ``__array_rank`` querying a type depending on a
1007+
template parameter. Now, such expression can be used with ``static_assert`` and ``constexpr``. (#GH123498)
1008+
- Correctly determine the implicit constexprness of lambdas in dependent contexts. (#GH97958) (#GH114234)
9941009

9951010
Bug Fixes to AST Handling
9961011
^^^^^^^^^^^^^^^^^^^^^^^^^

clang/include/clang/AST/APValue.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,9 @@ class APValue {
161161

162162
template <class T> T get() const { return cast<T>(Ptr); }
163163

164-
template <class T>
165-
T dyn_cast() const { return Ptr.dyn_cast<T>(); }
164+
template <class T> T dyn_cast() const {
165+
return dyn_cast_if_present<T>(Ptr);
166+
}
166167

167168
void *getOpaqueValue() const;
168169

clang/include/clang/AST/ASTContext.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -769,7 +769,7 @@ class ASTContext : public RefCountedBase<ASTContext> {
769769
/// pool.
770770
DeclListNode *AllocateDeclListNode(clang::NamedDecl *ND) {
771771
if (DeclListNode *Alloc = ListNodeFreeList) {
772-
ListNodeFreeList = Alloc->Rest.dyn_cast<DeclListNode*>();
772+
ListNodeFreeList = dyn_cast_if_present<DeclListNode *>(Alloc->Rest);
773773
Alloc->D = ND;
774774
Alloc->Rest = nullptr;
775775
return Alloc;

clang/include/clang/AST/Decl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4035,7 +4035,7 @@ class EnumDecl : public TagDecl {
40354035
/// Return the type source info for the underlying integer type,
40364036
/// if no type source info exists, return 0.
40374037
TypeSourceInfo *getIntegerTypeSourceInfo() const {
4038-
return IntegerType.dyn_cast<TypeSourceInfo*>();
4038+
return dyn_cast_if_present<TypeSourceInfo *>(IntegerType);
40394039
}
40404040

40414041
/// Retrieve the source range that covers the underlying type if

clang/include/clang/AST/DeclBase.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1391,7 +1391,7 @@ class DeclContextLookupResult {
13911391
const_iterator end() const { return iterator(); }
13921392

13931393
bool empty() const { return Result.isNull(); }
1394-
bool isSingleResult() const { return Result.dyn_cast<NamedDecl*>(); }
1394+
bool isSingleResult() const { return isa_and_present<NamedDecl *>(Result); }
13951395
reference front() const { return *begin(); }
13961396

13971397
// Find the first declaration of the given type in the list. Note that this

clang/include/clang/AST/DeclTemplate.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2009,7 +2009,8 @@ class ClassTemplateSpecializationDecl : public CXXRecordDecl,
20092009
/// Retrieve the template argument list as written in the sources,
20102010
/// if any.
20112011
const ASTTemplateArgumentListInfo *getTemplateArgsAsWritten() const {
2012-
if (auto *Info = ExplicitInfo.dyn_cast<ExplicitInstantiationInfo *>())
2012+
if (auto *Info =
2013+
dyn_cast_if_present<ExplicitInstantiationInfo *>(ExplicitInfo))
20132014
return Info->TemplateArgsAsWritten;
20142015
return cast<const ASTTemplateArgumentListInfo *>(ExplicitInfo);
20152016
}
@@ -2041,7 +2042,8 @@ class ClassTemplateSpecializationDecl : public CXXRecordDecl,
20412042

20422043
/// Gets the location of the template keyword, if present.
20432044
SourceLocation getTemplateKeywordLoc() const {
2044-
if (auto *Info = ExplicitInfo.dyn_cast<ExplicitInstantiationInfo *>())
2045+
if (auto *Info =
2046+
dyn_cast_if_present<ExplicitInstantiationInfo *>(ExplicitInfo))
20452047
return Info->TemplateKeywordLoc;
20462048
return SourceLocation();
20472049
}
@@ -2786,7 +2788,8 @@ class VarTemplateSpecializationDecl : public VarDecl,
27862788
/// Set the template argument list as written in the sources.
27872789
void
27882790
setTemplateArgsAsWritten(const ASTTemplateArgumentListInfo *ArgsWritten) {
2789-
if (auto *Info = ExplicitInfo.dyn_cast<ExplicitInstantiationInfo *>())
2791+
if (auto *Info =
2792+
dyn_cast_if_present<ExplicitInstantiationInfo *>(ExplicitInfo))
27902793
Info->TemplateArgsAsWritten = ArgsWritten;
27912794
else
27922795
ExplicitInfo = ArgsWritten;

clang/include/clang/AST/Expr.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5180,7 +5180,7 @@ class InitListExpr : public Expr {
51805180
/// than there are initializers in the list, specifies an expression to be
51815181
/// used for value initialization of the rest of the elements.
51825182
Expr *getArrayFiller() {
5183-
return ArrayFillerOrUnionFieldInit.dyn_cast<Expr *>();
5183+
return dyn_cast_if_present<Expr *>(ArrayFillerOrUnionFieldInit);
51845184
}
51855185
const Expr *getArrayFiller() const {
51865186
return const_cast<InitListExpr *>(this)->getArrayFiller();
@@ -5205,7 +5205,7 @@ class InitListExpr : public Expr {
52055205
/// union. However, a designated initializer can specify the
52065206
/// initialization of a different field within the union.
52075207
FieldDecl *getInitializedFieldInUnion() {
5208-
return ArrayFillerOrUnionFieldInit.dyn_cast<FieldDecl *>();
5208+
return dyn_cast_if_present<FieldDecl *>(ArrayFillerOrUnionFieldInit);
52095209
}
52105210
const FieldDecl *getInitializedFieldInUnion() const {
52115211
return const_cast<InitListExpr *>(this)->getInitializedFieldInUnion();

0 commit comments

Comments
 (0)