Skip to content

Commit 8bb8301

Browse files
committed
merge main into amd-staging
2 parents a852d97 + 5fda2a5 commit 8bb8301

File tree

80 files changed

+2010
-409
lines changed

Some content is hidden

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

80 files changed

+2010
-409
lines changed

.ci/monolithic-windows.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ runtimes_targets="${4}"
2323
start-group "CMake"
2424
pip install -q -r "${MONOREPO_ROOT}"/.ci/all_requirements.txt
2525

26-
export CC=cl
27-
export CXX=cl
26+
export CC=C:/clang/clang-msvc/bin/clang-cl.exe
27+
export CXX=C:/clang/clang-msvc/bin/clang-cl.exe
2828
export LD=link
2929

3030
# The CMAKE_*_LINKER_FLAGS to disable the manifest come from research
@@ -49,6 +49,7 @@ cmake -S "${MONOREPO_ROOT}"/llvm -B "${BUILD_DIR}" \
4949
-D CMAKE_EXE_LINKER_FLAGS="/MANIFEST:NO" \
5050
-D CMAKE_MODULE_LINKER_FLAGS="/MANIFEST:NO" \
5151
-D CMAKE_SHARED_LINKER_FLAGS="/MANIFEST:NO" \
52+
-D CMAKE_CXX_FLAGS="-Wno-c++98-compat -Wno-c++14-compat -Wno-unsafe-buffer-usage -Wno-old-style-cast" \
5253
-D LLVM_ENABLE_RUNTIMES="${runtimes}"
5354

5455
start-group "ninja"

.ci/utils.sh

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,17 @@ function at-exit {
4040
fi
4141

4242
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
4643
if [[ "$GITHUB_ACTIONS" != "" ]]; then
4744
python "${MONOREPO_ROOT}"/.ci/premerge_advisor_explain.py \
4845
$(git rev-parse HEAD~1) "${BUILD_DIR}"/test-results.*.xml \
4946
"${MONOREPO_ROOT}"/ninja*.log
47+
python "${MONOREPO_ROOT}"/.ci/premerge_advisor_upload.py \
48+
$(git rev-parse HEAD~1) $GITHUB_RUN_NUMBER \
49+
"${BUILD_DIR}"/test-results.*.xml "${MONOREPO_ROOT}"/ninja*.log
50+
else
51+
python "${MONOREPO_ROOT}"/.ci/premerge_advisor_upload.py \
52+
$(git rev-parse HEAD) $BUILDBOT_BUILDNUMBER \
53+
"${BUILD_DIR}"/test-results.*.xml "${MONOREPO_ROOT}"/ninja*.log
5054
fi
5155
fi
5256
}

.github/workflows/containers/github-action-ci-tooling/Dockerfile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,14 @@ RUN apt-get update && \
3737
apt-get clean && \
3838
rm -rf /var/lib/apt/lists/*
3939

40+
# Create a new user with id 1001 as that is the user id that
41+
# Github Actions uses to perform the checkout action.
42+
RUN useradd gha -u 1001 -m -s /bin/bash
43+
RUN adduser gha sudo
44+
RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
45+
# Don't set USER gha right away because we still need to install packages
46+
# as root in 'ci-container-code-format' and 'ci-container-code-lint' containers
47+
4048

4149
FROM base AS ci-container-code-format
4250
ARG LLVM_VERSION
@@ -51,6 +59,8 @@ ENV PATH=${LLVM_SYSROOT}/bin:${PATH}
5159
COPY llvm/utils/git/requirements_formatting.txt requirements_formatting.txt
5260
RUN pip install -r requirements_formatting.txt --break-system-packages && \
5361
rm requirements_formatting.txt
62+
USER gha
63+
WORKDIR /home/gha
5464

5565

5666
FROM base AS ci-container-code-lint
@@ -80,3 +90,5 @@ RUN apt-get update && \
8090
COPY llvm/utils/git/requirements_linting.txt requirements_linting.txt
8191
RUN pip install -r requirements_linting.txt --break-system-packages && \
8292
rm requirements_linting.txt
93+
USER gha
94+
WORKDIR /home/gha

.github/workflows/pr-code-format.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,6 @@ jobs:
2525
with:
2626
fetch-depth: 2
2727

28-
# We need to set the repo checkout as safe, otherwise tj-actions/changed-files
29-
# will fail due to the changed ownership inside the container.
30-
# TODO(boomanaiden154): We should probably fix this by having the default user
31-
# in the container have the same ID as the GHA user on the host.
32-
- name: Set Safe Directory
33-
run: |
34-
chown -R root $(pwd)
35-
3628
- name: Get changed files
3729
id: changed-files
3830
uses: tj-actions/changed-files@ed68ef82c095e0d48ec87eccea555d944a631a4c # v46.0.5

.github/workflows/pr-code-lint.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,6 @@ jobs:
3131
with:
3232
fetch-depth: 2
3333

34-
# FIXME: same as in ".github/workflows/pr-code-format.yml"
35-
- name: Set Safe Directory
36-
run: |
37-
chown -R root $(pwd)
38-
3934
- name: Get changed files
4035
id: changed-files
4136
uses: tj-actions/changed-files@ed68ef82c095e0d48ec87eccea555d944a631a4c # v46.0.5

clang/docs/UsersManual.rst

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Introduction
1111
============
1212

1313
The Clang Compiler is an open-source compiler for the C family of
14-
programming languages, aiming to be the best in class implementation of
14+
programming languages, aiming to be the best-in-class implementation of
1515
these languages. Clang builds on the LLVM optimizer and code generator,
1616
allowing it to provide high-quality optimization and code generation
1717
support for many targets. For more general information, please see the
@@ -56,7 +56,7 @@ migration from GCC to Clang. In most cases, code "just works".
5656
Clang also provides an alternative driver, :ref:`clang-cl`, that is designed
5757
to be compatible with the Visual C++ compiler, cl.exe.
5858

59-
In addition to language specific features, Clang has a variety of
59+
In addition to language-specific features, Clang has a variety of
6060
features that depend on what CPU architecture or operating system is
6161
being compiled for. Please see the :ref:`Target-Specific Features and
6262
Limitations <target_features>` section for more details.
@@ -299,7 +299,7 @@ output format of the diagnostics that it generates.
299299

300300
This option controls the output format of the filename, line number,
301301
and column printed in diagnostic messages. The options, and their
302-
affect on formatting a simple conversion diagnostic, follow:
302+
effect on formatting a simple conversion diagnostic, follow:
303303

304304
**clang** (default)
305305
::
@@ -360,7 +360,7 @@ output format of the diagnostics that it generates.
360360
t.c:3:11: warning: conversion specifies type 'char *' but the argument has type 'int' [-Wformat,Format String]
361361

362362
This category can be used by clients that want to group diagnostics
363-
by category, so it should be a high level category. We want dozens
363+
by category, so it should be a high-level category. We want dozens
364364
of these, not hundreds or thousands of them.
365365

366366
.. _opt_fsave-optimization-record:
@@ -750,7 +750,7 @@ control the crash diagnostics.
750750

751751
Disable auto-generation of preprocessed source files during a clang crash.
752752

753-
The -fno-crash-diagnostics flag can be helpful for speeding the process
753+
The ``-fno-crash-diagnostics`` flag can be helpful for speeding the process
754754
of generating a delta reduced test case.
755755

756756
.. option:: -fcrash-diagnostics-dir=<dir>
@@ -779,7 +779,7 @@ Options to Emit Optimization Reports
779779
------------------------------------
780780

781781
Optimization reports trace, at a high-level, all the major decisions
782-
done by compiler transformations. For instance, when the inliner
782+
made by compiler transformations. For instance, when the inliner
783783
decides to inline function ``foo()`` into ``bar()``, or the loop unroller
784784
decides to unroll a loop N times, or the vectorizer decides to
785785
vectorize a loop body.
@@ -845,11 +845,11 @@ compilations steps.
845845

846846
.. option:: -fproc-stat-report=
847847

848-
This option requests driver to print used memory and execution time of each
848+
This option requests the driver to print used memory and execution time of each
849849
compilation step. The ``clang`` driver during execution calls different tools,
850850
like compiler, assembler, linker etc. With this option the driver reports
851851
total execution time, the execution time spent in user mode and peak memory
852-
usage of each the called tool. Value of the option specifies where the report
852+
usage of each called tool. Value of the option specifies where the report
853853
is sent to. If it specifies a regular file, the data are saved to this file in
854854
CSV format:
855855

@@ -869,7 +869,7 @@ compilations steps.
869869
* peak memory usage in Kb.
870870

871871
It is possible to specify this option without any value. In this case statistics
872-
are printed on standard output in human readable format:
872+
are printed on standard output in human-readable format:
873873

874874
.. code-block:: console
875875
@@ -884,7 +884,7 @@ compilations steps.
884884

885885
You can also use environment variables to control the process statistics reporting.
886886
Setting ``CC_PRINT_PROC_STAT`` to ``1`` enables the feature, the report goes to
887-
stdout in human readable format.
887+
stdout in human-readable format.
888888
Setting ``CC_PRINT_PROC_STAT_FILE`` to a fully qualified file path makes it report
889889
process statistics to the given file in the CSV format. Specifying a relative
890890
path will likely lead to multiple files with the same name created in different
@@ -922,7 +922,7 @@ Clang options that don't fit neatly into other categories.
922922
most filenames can be written to the file without any special formatting.
923923
Different Make tools will treat different sets of characters as "special"
924924
and use different conventions for telling the Make tool that the character
925-
is actually part of the filename. Normally Clang uses backslash to "escape"
925+
is actually part of the filename. Normally, Clang uses backslash to "escape"
926926
a special character, which is the convention used by GNU Make. The -MV
927927
option tells Clang to put double-quotes around the entire filename, which
928928
is the convention used by NMake and Jom.
@@ -957,7 +957,7 @@ Configuration files
957957

958958
Configuration files group command-line options and allow all of them to be
959959
specified just by referencing the configuration file. They may be used, for
960-
example, to collect options required to tune compilation for particular
960+
example, to collect options required to tune compilation for a particular
961961
target, such as ``-L``, ``-I``, ``-l``, ``--sysroot``, codegen options, etc.
962962

963963
Configuration files can be either specified on the command line or loaded
@@ -986,7 +986,7 @@ either during build or during runtime. At build time, use
986986
``CLANG_CONFIG_FILE_USER_DIR`` and ``CLANG_CONFIG_FILE_SYSTEM_DIR``. At run
987987
time use the ``--config-user-dir=`` and ``--config-system-dir=`` command line
988988
options. Specifying config directories at runtime overrides the config
989-
directories set at build time The first file found is used. It is an error if
989+
directories set at build time. The first file found is used. It is an error if
990990
the required file cannot be found.
991991

992992
The default configuration files are searched for in the same directories
@@ -996,7 +996,7 @@ the ``--no-default-config`` flag.
996996

997997
First, the algorithm searches for a configuration file named
998998
``<triple>-<driver>.cfg`` where `triple` is the triple for the target being
999-
built for, and `driver` is the name of the currently used driver. The algorithm
999+
built, and `driver` is the name of the currently used driver. The algorithm
10001000
first attempts to use the canonical name for the driver used, then falls back
10011001
to the one found in the executable name.
10021002

@@ -1047,7 +1047,7 @@ It is not an error if either of these files is not found.
10471047
The configuration file consists of command-line options specified on one or
10481048
more lines. Lines composed of whitespace characters only are ignored as well as
10491049
lines in which the first non-blank character is ``#``. Long options may be split
1050-
between several lines by a trailing backslash. Here is example of a
1050+
between several lines by a trailing backslash. Here is an example of a
10511051
configuration file:
10521052

10531053
::
@@ -1229,7 +1229,7 @@ Clang also allows you to push and pop the current warning state. This is
12291229
particularly useful when writing a header file that will be compiled by
12301230
other people, because you don't know what warning flags they build with.
12311231

1232-
In the below example :option:`-Wextra-tokens` is ignored for only a single line
1232+
In the example below, :option:`-Wextra-tokens` is ignored for only a single line
12331233
of code, after which the diagnostics return to whatever state had previously
12341234
existed.
12351235

@@ -1253,7 +1253,7 @@ of warnings, so even when using GCC-compatible #pragmas there is no
12531253
guarantee that they will have identical behaviour on both compilers.
12541254

12551255
Clang also doesn't yet support GCC behavior for ``#pragma diagnostic pop``
1256-
that doesn't have a corresponding ``#pragma diagnostic push``. In this case
1256+
that doesn't have a corresponding ``#pragma diagnostic push``. In this case,
12571257
GCC pretends that there is a ``#pragma diagnostic push`` at the very beginning
12581258
of the source file, so "unpaired" ``#pragma diagnostic pop`` matches that
12591259
implicit push. This makes a difference for ``#pragma GCC diagnostic ignored``
@@ -1406,7 +1406,7 @@ project even if there are violations in some headers.
14061406
# directory. But it'll still complain for all the other sources, e.g:
14071407
$ cat foo/bar.cc
14081408
#include "dir/include.h" // Clang flags unused declarations here.
1409-
#include "foo/include.h" // but unused warnings under this source is omitted.
1409+
#include "foo/include.h" // but unused warnings under this source are omitted.
14101410
#include "next_to_bar_cc.h" // as are unused warnings from this header file.
14111411
// Further, unused warnings in the remainder of bar.cc are also omitted.
14121412
@@ -1648,7 +1648,7 @@ for more details.
16481648

16491649
.. option:: -fno-fast-math
16501650

1651-
Disable fast-math mode. This options disables unsafe floating-point
1651+
Disable fast-math mode. This option disables unsafe floating-point
16521652
optimizations by preventing the compiler from making any transformations that
16531653
could affect the results.
16541654

@@ -1766,7 +1766,7 @@ for more details.
17661766

17671767
* ``fast``: enable fusion across statements disregarding pragmas, breaking
17681768
compliance with the C and C++ standards (default for CUDA).
1769-
* ``on``: enable C and C++ standard complaint fusion in the same statement
1769+
* ``on``: enable C and C++ standard compliant fusion in the same statement
17701770
unless dictated by pragmas (default for languages other than CUDA/HIP)
17711771
* ``off``: disable fusion
17721772
* ``fast-honor-pragmas``: fuse across statements unless dictated by pragmas
@@ -1919,7 +1919,7 @@ for more details.
19191919
a single expression of the code.
19201920

19211921
Valid values are: ``source``, ``double``, and ``extended``.
1922-
For 64-bit targets, the default value is ``source``. For 32-bit x86 targets
1922+
For 64-bit targets, the default value is ``source``. For 32-bit x86 targets,
19231923
however, in the case of NETBSD 6.99.26 and under, the default value is
19241924
``double``; in the case of NETBSD greater than 6.99.26, with NoSSE, the
19251925
default value is ``extended``, with SSE the default value is ``source``.
@@ -3881,9 +3881,9 @@ See :doc:`LanguageExtensions`.
38813881
Differences between various standard modes
38823882
------------------------------------------
38833883

3884-
clang supports the -std option, which changes what language mode clang uses.
3884+
clang supports the ``-std`` option, which changes what language mode clang uses.
38853885
The supported modes for C are c89, gnu89, c94, c99, gnu99, c11, gnu11, c17,
3886-
gnu17, c23, gnu23, c2y, gnu2y, and various aliases for those modes. If no -std
3886+
gnu17, c23, gnu23, c2y, gnu2y, and various aliases for those modes. If no ``-std``
38873887
option is specified, clang defaults to gnu17 mode. Many C99 and C11 features
38883888
are supported in earlier modes as a conforming extension, with a warning. Use
38893889
``-pedantic-errors`` to request an error if a feature from a later standard
@@ -4609,7 +4609,7 @@ codebases.
46094609

46104610
On ``x86_64-mingw32``, passing i128(by value) is incompatible with the
46114611
Microsoft x64 calling convention. You might need to tweak
4612-
``WinX86_64ABIInfo::classify()`` in lib/CodeGen/Targets/X86.cpp.
4612+
``WinX86_64ABIInfo::classify()`` in ``lib/CodeGen/Targets/X86.cpp``.
46134613

46144614
For the X86 target, clang supports the `-m16` command line
46154615
argument which enables 16-bit code output. This is broadly similar to
@@ -4760,8 +4760,8 @@ is imported, the linker will generate fixup code for reading or writing to the
47604760
variable.
47614761

47624762
When multiple toc-data options are used, the last option used has the affect.
4763-
For example: -mno-tocdata=g5,g1 -mtocdata=g1,g2 -mno-tocdata=g2 -mtocdata=g3,g4
4764-
results in -mtocdata=g1,g3,g4
4763+
For example: ``-mno-tocdata=g5,g1 -mtocdata=g1,g2 -mno-tocdata=g2 -mtocdata=g3,g4``
4764+
results in ``-mtocdata=g1,g3,g4``
47654765

47664766
Names of variables not having external linkage will be ignored.
47674767

@@ -5143,16 +5143,16 @@ Execute ``clang-cl /?`` to see a list of supported options:
51435143
Instrument only functions from files where names match any regex separated by a semi-colon
51445144
-fprofile-generate=<dirname>
51455145
Generate instrumented code to collect execution counts into a raw profile file in the directory specified by the argument. The filename uses default_%m.profraw pattern
5146-
(overridden by LLVM_PROFILE_FILE env var)
5146+
(overridden by ``LLVM_PROFILE_FILE`` env var)
51475147
-fprofile-generate
51485148
Generate instrumented code to collect execution counts into default_%m.profraw file
5149-
(overridden by '=' form of option or LLVM_PROFILE_FILE env var)
5149+
(overridden by '=' form of option or ``LLVM_PROFILE_FILE`` env var)
51505150
-fprofile-instr-generate=<file_name_pattern>
51515151
Generate instrumented code to collect execution counts into the file whose name pattern is specified as the argument
5152-
(overridden by LLVM_PROFILE_FILE env var)
5152+
(overridden by ``LLVM_PROFILE_FILE`` env var)
51535153
-fprofile-instr-generate
51545154
Generate instrumented code to collect execution counts into default.profraw file
5155-
(overridden by '=' form of option or LLVM_PROFILE_FILE env var)
5155+
(overridden by '=' form of option or ``LLVM_PROFILE_FILE`` env var)
51565156
-fprofile-instr-use=<value>
51575157
Use instrumentation data for coverage testing or profile-guided optimization
51585158
-fprofile-use=<value>

clang/include/clang/CIR/MissingFeatures.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,11 +150,9 @@ struct MissingFeatures {
150150
static bool zeroSizeRecordMembers() { return false; }
151151

152152
// Coroutines
153-
static bool coroAllocBuiltinCall() { return false; }
154-
static bool coroBeginBuiltinCall() { return false; }
155153
static bool coroEndBuiltinCall() { return false; }
156-
static bool coroSizeBuiltinCall() { return false; }
157154
static bool coroutineFrame() { return false; }
155+
static bool emitBodyAndFallthrough() { return false; }
158156

159157
// Various handling of deferred processing in CIRGenModule.
160158
static bool cgmRelease() { return false; }

clang/include/clang/Sema/Sema.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2681,11 +2681,6 @@ class Sema final : public SemaBase {
26812681
/// function without this attribute.
26822682
bool DiscardingCFIUncheckedCallee(QualType From, QualType To) const;
26832683

2684-
/// Returns true if `From` is a function or pointer to a function without the
2685-
/// `cfi_unchecked_callee` attribute but `To` is a function or pointer to
2686-
/// function with this attribute.
2687-
bool AddingCFIUncheckedCallee(QualType From, QualType To) const;
2688-
26892684
/// This function calls Action when it determines that E designates a
26902685
/// misaligned member due to the packed attribute. This is used to emit
26912686
/// local diagnostics like in reference binding.

clang/lib/CIR/CodeGen/CIRGenBuiltin.cpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -449,10 +449,15 @@ RValue CIRGenFunction::emitBuiltinExpr(const GlobalDecl &gd, unsigned builtinID,
449449
}
450450
case Builtin::BI__builtin_coro_free:
451451
case Builtin::BI__builtin_coro_size: {
452-
cgm.errorNYI(e->getSourceRange(),
453-
"BI__builtin_coro_free, BI__builtin_coro_size NYI");
454-
assert(!cir::MissingFeatures::coroSizeBuiltinCall());
455-
return getUndefRValue(e->getType());
452+
GlobalDecl gd{fd};
453+
mlir::Type ty = cgm.getTypes().getFunctionType(
454+
cgm.getTypes().arrangeGlobalDeclaration(gd));
455+
const auto *nd = cast<NamedDecl>(gd.getDecl());
456+
cir::FuncOp fnOp =
457+
cgm.getOrCreateCIRFunction(nd->getName(), ty, gd, /*ForVTable=*/false);
458+
fnOp.setBuiltin(true);
459+
return emitCall(e->getCallee()->getType(), CIRGenCallee::forDirect(fnOp), e,
460+
returnValue);
456461
}
457462
case Builtin::BI__builtin_prefetch: {
458463
auto evaluateOperandAsInt = [&](const Expr *arg) {

0 commit comments

Comments
 (0)