Skip to content

Commit 7c88b65

Browse files
committed
Merge branch 'main' into load-matrix-WI-attributes
2 parents f8766e0 + 01c0cb9 commit 7c88b65

File tree

513 files changed

+18547
-5467
lines changed

Some content is hidden

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

513 files changed

+18547
-5467
lines changed

.ci/monolithic-linux.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,13 @@ start-group "ninja"
6666

6767
# Targets are not escaped as they are passed as separate arguments.
6868
ninja -C "${BUILD_DIR}" -k 0 ${targets} |& tee ninja.log
69+
cp ${BUILD_DIR}/.ninja_log ninja.ninja_log
6970

7071
if [[ "${runtime_targets}" != "" ]]; then
7172
start-group "ninja Runtimes"
7273

7374
ninja -C "${BUILD_DIR}" ${runtime_targets} |& tee ninja_runtimes.log
75+
cp ${BUILD_DIR}/.ninja_log ninja_runtimes.ninja_log
7476
fi
7577

7678
# Compiling runtimes with just-built Clang and running their tests
@@ -87,6 +89,7 @@ if [[ "${runtime_targets_needs_reconfig}" != "" ]]; then
8789

8890
ninja -C "${BUILD_DIR}" ${runtime_targets_needs_reconfig} \
8991
|& tee ninja_runtimes_needs_reconfig1.log
92+
cp ${BUILD_DIR}/.ninja_log ninja_runtimes_needs_reconig.ninja_log
9093

9194
start-group "CMake Runtimes Clang Modules"
9295

@@ -99,4 +102,5 @@ if [[ "${runtime_targets_needs_reconfig}" != "" ]]; then
99102

100103
ninja -C "${BUILD_DIR}" ${runtime_targets_needs_reconfig} \
101104
|& tee ninja_runtimes_needs_reconfig2.log
105+
cp ${BUILD_DIR}/.ninja_log ninja_runtimes_needs_reconfig2.ninja_log
102106
fi

.ci/monolithic-windows.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,11 @@ start-group "ninja"
5555

5656
# Targets are not escaped as they are passed as separate arguments.
5757
ninja -C "${BUILD_DIR}" -k 0 ${targets} |& tee ninja.log
58+
cp ${BUILD_DIR}/.ninja_log ninja.ninja_log
5859

5960
if [[ "${runtime_targets}" != "" ]]; then
6061
start-group "ninja runtimes"
6162

6263
ninja -C "${BUILD_DIR}" -k 0 ${runtimes_targets} |& tee ninja_runtimes.log
64+
cp ${BUILD_DIR}/.ninja_log ninja_runtimes.ninja_log
6365
fi

.ci/premerge_advisor_upload.py

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
2+
# See https://llvm.org/LICENSE.txt for license information.
3+
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
4+
"""Script for uploading results to the premerge advisor."""
5+
6+
import argparse
7+
import os
8+
import platform
9+
import sys
10+
11+
import requests
12+
13+
import generate_test_report_lib
14+
15+
PREMERGE_ADVISOR_URL = (
16+
"http://premerge-advisor.premerge-advisor.svc.cluster.local:5000/upload"
17+
)
18+
19+
20+
def main(commit_sha, workflow_run_number, build_log_files):
21+
junit_objects, ninja_logs = generate_test_report_lib.load_info_from_files(
22+
build_log_files
23+
)
24+
test_failures = generate_test_report_lib.get_failures(junit_objects)
25+
source = "pull_request" if "GITHUB_ACTIONS" in os.environ else "postcommit"
26+
current_platform = f"{platform.system()}-{platform.machine()}".lower()
27+
failure_info = {
28+
"source_type": source,
29+
"base_commit_sha": commit_sha,
30+
"source_id": workflow_run_number,
31+
"failures": [],
32+
"platform": current_platform,
33+
}
34+
if test_failures:
35+
for name, failure_message in test_failures:
36+
failure_info["failures"].append({"name": name, "message": failure_message})
37+
else:
38+
ninja_failures = generate_test_report_lib.find_failure_in_ninja_logs(ninja_logs)
39+
for name, failure_message in ninja_failures:
40+
failure_info["failures"].append({"name": name, "message": failure_message})
41+
requests.post(PREMERGE_ADVISOR_URL, json=failure_info)
42+
43+
44+
if __name__ == "__main__":
45+
parser = argparse.ArgumentParser()
46+
parser.add_argument("commit_sha", help="The base commit SHA for the test.")
47+
parser.add_argument("workflow_run_number", help="The run number from GHA.")
48+
parser.add_argument(
49+
"build_log_files", help="Paths to JUnit report files and ninja logs.", nargs="*"
50+
)
51+
args = parser.parse_args()
52+
53+
# Skip uploading results on AArch64 for now because the premerge advisor
54+
# service is not available on AWS currently.
55+
if platform.machine() == "arm64":
56+
sys.exit(0)
57+
58+
main(args.commit_sha, args.workflow_run_number, args.build_log_files)

.ci/utils.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ function at-exit {
2626
mkdir -p artifacts
2727
sccache --show-stats
2828
sccache --show-stats >> artifacts/sccache_stats.txt
29-
cp "${BUILD_DIR}"/.ninja_log artifacts/.ninja_log
29+
cp "${MONOREPO_ROOT}"/*.ninja_log artifacts/ || :
3030
cp "${MONOREPO_ROOT}"/*.log artifacts/ || :
3131
cp "${BUILD_DIR}"/test-results.*.xml artifacts/ || :
3232

@@ -38,6 +38,12 @@ function at-exit {
3838
$retcode "${BUILD_DIR}"/test-results.*.xml "${MONOREPO_ROOT}"/ninja*.log \
3939
>> $GITHUB_STEP_SUMMARY
4040
fi
41+
42+
if [[ "$retcode" != "0" ]]; then
43+
python "${MONOREPO_ROOT}"/.ci/premerge_advisor_upload.py \
44+
$(git rev-parse HEAD~1) $GITHUB_RUN_NUMBER \
45+
"${BUILD_DIR}"/test-results.*.xml "${MONOREPO_ROOT}"/ninja*.log
46+
fi
4147
}
4248
trap at-exit EXIT
4349

bolt/unittests/Core/MCPlusBuilder.cpp

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,82 @@ TEST_P(MCPlusBuilderTester, testAccessedRegsMultipleDefs) {
261261
{AArch64::W5, AArch64::X5, AArch64::W5_HI});
262262
}
263263

264+
TEST_P(MCPlusBuilderTester, AArch64_Psign_Pauth_variants) {
265+
if (GetParam() != Triple::aarch64)
266+
GTEST_SKIP();
267+
268+
MCInst Paciasp = MCInstBuilder(AArch64::PACIASP);
269+
MCInst Pacibsp = MCInstBuilder(AArch64::PACIBSP);
270+
ASSERT_TRUE(BC->MIB->isPSignOnLR(Paciasp));
271+
ASSERT_TRUE(BC->MIB->isPSignOnLR(Pacibsp));
272+
273+
MCInst PaciaSPLR =
274+
MCInstBuilder(AArch64::PACIA).addReg(AArch64::LR).addReg(AArch64::SP);
275+
MCInst PacibSPLR =
276+
MCInstBuilder(AArch64::PACIB).addReg(AArch64::LR).addReg(AArch64::SP);
277+
ASSERT_TRUE(BC->MIB->isPSignOnLR(PaciaSPLR));
278+
ASSERT_TRUE(BC->MIB->isPSignOnLR(PacibSPLR));
279+
280+
MCInst PacizaX5 = MCInstBuilder(AArch64::PACIZA).addReg(AArch64::X5);
281+
MCInst PacizbX5 = MCInstBuilder(AArch64::PACIZB).addReg(AArch64::X5);
282+
ASSERT_FALSE(BC->MIB->isPSignOnLR(PacizaX5));
283+
ASSERT_FALSE(BC->MIB->isPSignOnLR(PacizbX5));
284+
285+
MCInst Paciaz = MCInstBuilder(AArch64::PACIZA).addReg(AArch64::LR);
286+
MCInst Pacibz = MCInstBuilder(AArch64::PACIZB).addReg(AArch64::LR);
287+
ASSERT_TRUE(BC->MIB->isPSignOnLR(Paciaz));
288+
ASSERT_TRUE(BC->MIB->isPSignOnLR(Pacibz));
289+
290+
MCInst Pacia1716 = MCInstBuilder(AArch64::PACIA1716);
291+
MCInst Pacib1716 = MCInstBuilder(AArch64::PACIB1716);
292+
ASSERT_FALSE(BC->MIB->isPSignOnLR(Pacia1716));
293+
ASSERT_FALSE(BC->MIB->isPSignOnLR(Pacib1716));
294+
295+
MCInst Pacia171615 = MCInstBuilder(AArch64::PACIA171615);
296+
MCInst Pacib171615 = MCInstBuilder(AArch64::PACIB171615);
297+
ASSERT_FALSE(BC->MIB->isPSignOnLR(Pacia171615));
298+
ASSERT_FALSE(BC->MIB->isPSignOnLR(Pacib171615));
299+
300+
MCInst Autiasp = MCInstBuilder(AArch64::AUTIASP);
301+
MCInst Autibsp = MCInstBuilder(AArch64::AUTIBSP);
302+
ASSERT_TRUE(BC->MIB->isPAuthOnLR(Autiasp));
303+
ASSERT_TRUE(BC->MIB->isPAuthOnLR(Autibsp));
304+
305+
MCInst AutiaSPLR =
306+
MCInstBuilder(AArch64::AUTIA).addReg(AArch64::LR).addReg(AArch64::SP);
307+
MCInst AutibSPLR =
308+
MCInstBuilder(AArch64::AUTIB).addReg(AArch64::LR).addReg(AArch64::SP);
309+
ASSERT_TRUE(BC->MIB->isPAuthOnLR(AutiaSPLR));
310+
ASSERT_TRUE(BC->MIB->isPAuthOnLR(AutibSPLR));
311+
312+
MCInst AutizaX5 = MCInstBuilder(AArch64::AUTIZA).addReg(AArch64::X5);
313+
MCInst AutizbX5 = MCInstBuilder(AArch64::AUTIZB).addReg(AArch64::X5);
314+
ASSERT_FALSE(BC->MIB->isPAuthOnLR(AutizaX5));
315+
ASSERT_FALSE(BC->MIB->isPAuthOnLR(AutizbX5));
316+
317+
MCInst Autiaz = MCInstBuilder(AArch64::AUTIZA).addReg(AArch64::LR);
318+
MCInst Autibz = MCInstBuilder(AArch64::AUTIZB).addReg(AArch64::LR);
319+
ASSERT_TRUE(BC->MIB->isPAuthOnLR(Autiaz));
320+
ASSERT_TRUE(BC->MIB->isPAuthOnLR(Autibz));
321+
322+
MCInst Autia1716 = MCInstBuilder(AArch64::AUTIA1716);
323+
MCInst Autib1716 = MCInstBuilder(AArch64::AUTIB1716);
324+
ASSERT_FALSE(BC->MIB->isPAuthOnLR(Autia1716));
325+
ASSERT_FALSE(BC->MIB->isPAuthOnLR(Autib1716));
326+
327+
MCInst Autia171615 = MCInstBuilder(AArch64::AUTIA171615);
328+
MCInst Autib171615 = MCInstBuilder(AArch64::AUTIB171615);
329+
ASSERT_FALSE(BC->MIB->isPAuthOnLR(Autia171615));
330+
ASSERT_FALSE(BC->MIB->isPAuthOnLR(Autib171615));
331+
332+
MCInst Retaa = MCInstBuilder(AArch64::RETAA);
333+
MCInst Retab = MCInstBuilder(AArch64::RETAB);
334+
ASSERT_FALSE(BC->MIB->isPAuthOnLR(Retaa));
335+
ASSERT_FALSE(BC->MIB->isPAuthOnLR(Retab));
336+
ASSERT_TRUE(BC->MIB->isPAuthAndRet(Retaa));
337+
ASSERT_TRUE(BC->MIB->isPAuthAndRet(Retab));
338+
}
339+
264340
#endif // AARCH64_AVAILABLE
265341

266342
#ifdef X86_AVAILABLE

clang-tools-extra/test/clang-tidy/checkers/misc/misplaced-const-cxx17.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// This test previously would cause a failed assertion because the structured
44
// binding declaration had no valid type associated with it. This ensures the
55
// expected clang diagnostic is generated instead.
6-
// CHECK-MESSAGES: :[[@LINE+1]]:6: error: decomposition declaration '[x]' requires an initializer [clang-diagnostic-error]
6+
// CHECK-MESSAGES: :[[@LINE+1]]:6: error: structured binding declaration '[x]' requires an initializer [clang-diagnostic-error]
77
auto [x];
88

99
struct S { int a; };

clang/cmake/modules/CMakeLists.txt

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,19 @@ include(FindPrefixFromConfig)
88
# the usual CMake convention seems to be ${Project}Targets.cmake.
99
set(CLANG_INSTALL_PACKAGE_DIR "${CMAKE_INSTALL_PACKAGEDIR}/clang" CACHE STRING
1010
"Path for CMake subdirectory for Clang (defaults to '${CMAKE_INSTALL_PACKAGEDIR}/clang')")
11-
# CMAKE_INSTALL_PACKAGEDIR might be absolute, so don't reuse below.
12-
set(clang_cmake_builddir "${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/cmake/clang")
1311

1412
# Keep this in sync with llvm/cmake/CMakeLists.txt!
1513
set(LLVM_INSTALL_PACKAGE_DIR "${CMAKE_INSTALL_PACKAGEDIR}/llvm" CACHE STRING
1614
"Path for CMake subdirectory for LLVM (defaults to '${CMAKE_INSTALL_PACKAGEDIR}/llvm')")
1715
# CMAKE_INSTALL_PACKAGEDIR might be absolute, so don't reuse below.
18-
string(REPLACE "${CMAKE_CFG_INTDIR}" "." llvm_cmake_builddir "${LLVM_LIBRARY_DIR}")
19-
set(llvm_cmake_builddir "${llvm_cmake_builddir}/cmake/llvm")
16+
string(REPLACE "${CMAKE_CFG_INTDIR}" "." llvm_builddir "${LLVM_LIBRARY_DIR}")
17+
set(llvm_cmake_builddir "${llvm_builddir}/cmake/llvm")
18+
if(CLANG_BUILT_STANDALONE)
19+
# CMAKE_INSTALL_PACKAGEDIR might be absolute, so don't reuse below.
20+
set(clang_cmake_builddir "${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/cmake/clang")
21+
else()
22+
set(clang_cmake_builddir "${llvm_builddir}/cmake/clang")
23+
endif()
2024

2125
get_property(CLANG_EXPORTS GLOBAL PROPERTY CLANG_EXPORTS)
2226
export(TARGETS ${CLANG_EXPORTS} FILE ${clang_cmake_builddir}/ClangTargets.cmake)

clang/docs/ReleaseNotes.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,8 @@ Attribute Changes in Clang
304304

305305
Improvements to Clang's diagnostics
306306
-----------------------------------
307+
- Diagnostics messages now refer to ``structured binding`` instead of ``decomposition``,
308+
to align with `P0615R0 <https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0615r0.html>`_ changing the term. (#GH157880)
307309
- Added a separate diagnostic group ``-Wfunction-effect-redeclarations``, for the more pedantic
308310
diagnostics for function effects (``[[clang::nonblocking]]`` and ``[[clang::nonallocating]]``).
309311
Moved the warning for a missing (though implied) attribute on a redeclaration into this group.
@@ -518,6 +520,7 @@ X86 Support
518520
- Remove `[no-]evex512` feature request from intrinsics and builtins.
519521
- Change features `avx10.x-[256,512]` to `avx10.x`.
520522
- `-march=wildcatlake` is now supported.
523+
- `-march=novalake` is now supported.
521524

522525
Arm and AArch64 Support
523526
^^^^^^^^^^^^^^^^^^^^^^^

clang/docs/analyzer/checkers.rst

Lines changed: 44 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,50 @@ pointers with a specified address space. If the option is set to false, then
205205
reports from the specific x86 address spaces 256, 257 and 258 are still
206206
suppressed, but null dereferences from other address spaces are reported.
207207
208+
.. _core-NullPointerArithm:
209+
210+
core.NullPointerArithm (C, C++)
211+
"""""""""""""""""""""""""""""""
212+
Check for undefined arithmetic operations with null pointers.
213+
214+
The checker can detect the following cases:
215+
216+
- ``p + x`` and ``x + p`` where ``p`` is a null pointer and ``x`` is a nonzero
217+
integer value.
218+
- ``p - x`` where ``p`` is a null pointer and ``x`` is a nonzero integer
219+
value.
220+
- ``p1 - p2`` where one of ``p1`` and ``p2`` is null and the other a
221+
non-null pointer.
222+
223+
Result of these operations is undefined according to the standard.
224+
In the above listed cases, the checker will warn even if the expression
225+
described to be "nonzero" or "non-null" has unknown value, because it is likely
226+
that it can have non-zero value during the program execution.
227+
228+
.. code-block:: c
229+
230+
void test1(int *p, int offset) {
231+
if (p)
232+
return;
233+
234+
int *p1 = p + offset; // warn: 'p' is null, 'offset' is unknown but likely non-zero
235+
}
236+
237+
void test2(int *p, int offset) {
238+
if (p) { } // this indicates that it is possible for 'p' to be null
239+
if (offset == 0)
240+
return;
241+
242+
int *p1 = p - offset; // warn: 'p' is null, 'offset' is known to be non-zero
243+
}
244+
245+
void test3(char *p1, char *p2) {
246+
if (p1)
247+
return;
248+
249+
int a = p1 - p2; // warn: 'p1' is null, 'p2' can be likely non-null
250+
}
251+
208252
.. _core-StackAddressEscape:
209253
210254
core.StackAddressEscape (C)
@@ -3421,12 +3465,6 @@ Check for an out-of-bound pointer being returned to callers.
34213465
return x; // warn: undefined or garbage returned
34223466
}
34233467
3424-
3425-
alpha.security.cert
3426-
^^^^^^^^^^^^^^^^^^^
3427-
3428-
SEI CERT checkers which tries to find errors based on their `C coding rules <https://wiki.sei.cmu.edu/confluence/display/c/2+Rules>`_.
3429-
34303468
alpha.unix
34313469
^^^^^^^^^^
34323470

clang/include/clang/AST/TypeBase.h

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4378,8 +4378,6 @@ class ConstantMatrixType final : public MatrixType {
43784378
unsigned NumRows;
43794379
unsigned NumColumns;
43804380

4381-
static constexpr unsigned MaxElementsPerDimension = (1 << 20) - 1;
4382-
43834381
ConstantMatrixType(QualType MatrixElementType, unsigned NRows,
43844382
unsigned NColumns, QualType CanonElementType);
43854383

@@ -4398,16 +4396,6 @@ class ConstantMatrixType final : public MatrixType {
43984396
return getNumRows() * getNumColumns();
43994397
}
44004398

4401-
/// Returns true if \p NumElements is a valid matrix dimension.
4402-
static constexpr bool isDimensionValid(size_t NumElements) {
4403-
return NumElements > 0 && NumElements <= MaxElementsPerDimension;
4404-
}
4405-
4406-
/// Returns the maximum number of elements per dimension.
4407-
static constexpr unsigned getMaxElementsPerDimension() {
4408-
return MaxElementsPerDimension;
4409-
}
4410-
44114399
void Profile(llvm::FoldingSetNodeID &ID) {
44124400
Profile(ID, getElementType(), getNumRows(), getNumColumns(),
44134401
getTypeClass());

0 commit comments

Comments
 (0)