Skip to content

Commit a78dcd3

Browse files
authored
merge main into amd-staging (#745)
2 parents a53d157 + 805a8ad commit a78dcd3

File tree

125 files changed

+4664
-544
lines changed

Some content is hidden

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

125 files changed

+4664
-544
lines changed

.github/workflows/release-sources.yml

Lines changed: 37 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,11 @@ jobs:
6464
name: Package Release Sources
6565
if: github.repository_owner == 'llvm'
6666
runs-on: ubuntu-24.04
67+
outputs:
68+
digest: ${{ steps.digest.outputs.digest }}
69+
artifact-id: ${{ steps.artifact-upload.outputs.artifact-id }}
6770
needs:
6871
- inputs
69-
permissions:
70-
id-token: write
71-
attestations: write
7272
steps:
7373
- name: Checkout LLVM
7474
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
@@ -79,30 +79,47 @@ jobs:
7979
run: |
8080
pip install --require-hashes -r ./llvm/utils/git/requirements.txt
8181
82-
- name: Check Permissions
83-
if: github.event_name != 'pull_request'
84-
env:
85-
GITHUB_TOKEN: ${{ github.token }}
86-
USER_TOKEN: ${{ secrets.RELEASE_TASKS_USER_TOKEN }}
87-
run: |
88-
./llvm/utils/release/./github-upload-release.py --token "$GITHUB_TOKEN" --user ${{ github.actor }} --user-token "$USER_TOKEN" check-permissions
8982
- name: Create Tarballs
9083
run: |
9184
./llvm/utils/release/export.sh ${{ needs.inputs.outputs.export-args }}
92-
- name: Attest Build Provenance
93-
if: github.event_name != 'pull_request'
94-
id: provenance
95-
uses: actions/attest-build-provenance@977bb373ede98d70efdf65b84cb5f73e068dcc2a # v3.0.0
96-
with:
97-
subject-path: "*.xz"
98-
- if: github.event_name != 'pull_request'
85+
86+
- name: Generate sha256 digest for sources
87+
id: digest
9988
run: |
100-
mv ${{ steps.provenance.outputs.bundle-path }} .
101-
- name: Create Tarball Artifacts
89+
echo "digest=$(cat *.xz | sha256sum | cut -d ' ' -f 1)" >> $GITHUB_OUTPUT
90+
91+
- name: Release Sources Artifact
92+
id: artifact-upload
10293
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
10394
with:
95+
name: ${{ needs.inputs.outputs.ref }}-sources
10496
path: |
10597
*.xz
106-
attestation.jsonl
10798
99+
attest-release-sources:
100+
name: Attest Release Sources
101+
runs-on: ubuntu-24.04
102+
if: github.event_name != 'pull_request'
103+
needs:
104+
- inputs
105+
- release-sources
106+
permissions:
107+
id-token: write
108+
attestations: write
109+
steps:
110+
- name: Checkout Release Scripts
111+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
112+
with:
113+
sparse-checkout: |
114+
.github/workflows/upload-release-artifact
115+
llvm/utils/release/github-upload-release.py
116+
llvm/utils/git/requirements.txt
117+
sparse-checkout-cone-mode: false
108118

119+
- name: Upload Artifacts
120+
uses: ./.github/workflows/upload-release-artifact
121+
with:
122+
artifact-id: ${{ needs.release-sources.outputs.artifact-id }}
123+
attestation-name: ${{ needs.inputs.outputs.ref }}-sources-attestation
124+
digest: ${{ needs.release-sources.outputs.digest }}
125+
upload: false
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
name: Upload Release Artifact
2+
description: >-
3+
Upload release artifact along with an attestation. The action assumes that
4+
the llvm-project repository has already been checked out.
5+
inputs:
6+
release-version:
7+
description: >-
8+
The release where the artifact will be attached.
9+
required: true
10+
upload:
11+
description: >-
12+
Whether or not to upload the file and attestation to the release. If this
13+
is set to false, then the file will be uploaded to the job as an artifact,
14+
but no atteastion will be generated and the artifact won't be uploaded
15+
to the release.
16+
default: true
17+
user-token:
18+
description: >-
19+
Token with premissions to read llvm teams that is used to ensure that
20+
the person who triggred the action has permission to upload artifacts.
21+
This is required if upload is true.
22+
requred: false
23+
attestation-name:
24+
description: >-
25+
This will be used for the artifact name that is attached to the workflow and
26+
will be used as the basename for the attestation file which will be called
27+
$attestation-name.jsonl. If this is not set, it will default
28+
to the falue of `files`.
29+
required: false
30+
artifact-id:
31+
description: >-
32+
Artifact id of the artifact with the files to upload.
33+
required: true
34+
digest:
35+
description: >-
36+
sha256 digest to verify the authenticity of the files being uploaded.
37+
required: true
38+
39+
runs:
40+
using: "composite"
41+
steps:
42+
- name: Download Artifact
43+
uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0
44+
id: download-artifact
45+
with:
46+
artifact-ids: ${{ inputs.artifact-id }}
47+
path: downloads
48+
49+
# In theory github artifacts are immutable so we could just rely on using
50+
# the artifact-id to download it, but just to be extra safe we want to
51+
# generated a digest for the files we are uploading so we can verify it
52+
# when downloading.
53+
# See also: https://irsl.medium.com/github-artifact-immutability-is-a-lie-9b6244095694
54+
- name: Verify Files
55+
shell: bash
56+
env:
57+
INPUTS_DIGEST: ${{ inputs.digest }}
58+
run: |
59+
digest_file="sha256"
60+
echo "$INPUTS_DIGEST -" > $digest_file
61+
cat ${{ steps.download-artifact.outputs.download-path }}/* | sha256sum -c $digest_file
62+
63+
- name: Attest Build Provenance
64+
id: provenance
65+
uses: actions/attest-build-provenance@977bb373ede98d70efdf65b84cb5f73e068dcc2a # v3.0.0
66+
with:
67+
subject-path: ${{ steps.download-artifact.outputs.download-path }}/*
68+
69+
- name: Rename attestation file
70+
shell: bash
71+
env:
72+
INPUTS_ATTESTATION_NAME: ${{ inputs.attestation-name }}
73+
run: |
74+
mv ${{ steps.provenance.outputs.bundle-path }} "$INPUTS_ATTESTATION_NAME".jsonl
75+
76+
- name: Upload Build Provenance
77+
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
78+
with:
79+
name: ${{ inputs.attestation-name }}
80+
path: |
81+
${{ inputs.attestation-name }}.jsonl
82+
83+
- name: Install Python Requirements
84+
if: inputs.upload == 'true'
85+
shell: bash
86+
run: |
87+
pip install --require-hashes -r ./llvm/utils/git/requirements.txt
88+
89+
- name: Check Permissions
90+
if: inputs.upload == 'true'
91+
env:
92+
GITHUB_TOKEN: ${{ github.token }}
93+
USER_TOKEN: ${{ inputs.user-token }}
94+
shell: bash
95+
run: |
96+
./llvm/utils/release/./github-upload-release.py --token "$GITHUB_TOKEN" --user "$GITHUB_ACTOR" --user-token "$USER_TOKEN" check-permissions
97+
- name: Upload Release
98+
shell: bash
99+
if: inputs.upload == 'true'
100+
run: |
101+
./llvm/utils/release/github-upload-release.py \
102+
--token ${{ github.token }} \
103+
--release ${{ inputs.release-version }} \
104+
upload \
105+
--files ${{ steps.download-artifact.outputs.download-path }}/* ${{ steps.vars.outputs.attestation-name}}.jsonl

clang-tools-extra/clangd/test/lit.cfg.py

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,28 @@
1+
import os
2+
import shutil
3+
14
import lit.llvm
25
import lit.util
36

47
lit.llvm.initialize(lit_config, config)
58
lit.llvm.llvm_config.clang_setup()
69
lit.llvm.llvm_config.use_default_substitutions()
710

11+
# TODO: Consolidate the logic for turning on the internal shell by default for all LLVM test suites.
12+
# See https://github.com/llvm/llvm-project/issues/106636 for more details.
13+
#
14+
# We prefer the lit internal shell which provides a better user experience on failures
15+
# and is faster unless the user explicitly disables it with LIT_USE_INTERNAL_SHELL=0
16+
# env var.
17+
use_lit_shell = True
18+
lit_shell_env = os.environ.get("LIT_USE_INTERNAL_SHELL")
19+
if lit_shell_env:
20+
use_lit_shell = lit.util.pythonize_bool(lit_shell_env)
21+
822
config.name = "Clangd"
923
config.suffixes = [".test"]
1024
config.excludes = ["Inputs"]
11-
config.test_format = lit.formats.ShTest(not lit.llvm.llvm_config.use_lit_shell)
25+
config.test_format = lit.formats.ShTest(not use_lit_shell)
1226
config.test_source_root = config.clangd_source_dir + "/test"
1327
config.test_exec_root = config.clangd_binary_dir + "/test"
1428

@@ -41,6 +55,13 @@ def calculate_arch_features(arch_string):
4155
if lit.util.pythonize_bool(config.have_benchmarks):
4256
config.available_features.add("have-benchmarks")
4357

58+
# This is needed to avoid running a single test (system-include-extractor.test)
59+
# on a single buildbot (clangd-ubuntu-tsan) and likely should not be needed. We
60+
# are able to unconditionally assume a chmod binary exists for check-llvm.
61+
# TODO(boomanaiden154): Fix this after investigating the bot setup.
62+
if shutil.which("chmod"):
63+
config.available_features.add("chmod")
64+
4465
# It is not realistically possible to account for all options that could
4566
# possibly be present in system and user configuration files, so disable
4667
# default configs for the test runs.

clang-tools-extra/clangd/test/system-include-extractor.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# RUN: rm -rf %t.dir && mkdir -p %t.dir
22

33
# The mock driver below is a shell script:
4-
# REQUIRES: shell
4+
# REQUIRES: shell, chmod
55

66
# Create a bin directory to store the mock-driver and add it to the path
77
# RUN: mkdir -p %t.dir/bin

clang/docs/ReleaseNotes.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,12 @@ Attribute Changes in Clang
355355
attribute, but `malloc_span` applies not to functions returning pointers, but to functions returning
356356
span-like structures (i.e. those that contain a pointer field and a size integer field or two pointers).
357357

358+
- Added new attribute ``modular_format`` to allow dynamically selecting at link
359+
time which aspects of a statically linked libc's printf (et al)
360+
implementation are required. This can reduce code size without requiring e.g.
361+
multilibs for printf features. Requires cooperation with the libc
362+
implementation.
363+
358364
Improvements to Clang's diagnostics
359365
-----------------------------------
360366

clang/include/clang/Basic/Attr.td

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5331,3 +5331,11 @@ def NonString : InheritableAttr {
53315331
let Subjects = SubjectList<[Var, Field]>;
53325332
let Documentation = [NonStringDocs];
53335333
}
5334+
5335+
def ModularFormat : InheritableAttr {
5336+
let Spellings = [Clang<"modular_format">];
5337+
let Args = [IdentifierArgument<"ModularImplFn">, StringArgument<"ImplName">,
5338+
VariadicStringArgument<"Aspects">];
5339+
let Subjects = SubjectList<[Function]>;
5340+
let Documentation = [ModularFormatDocs];
5341+
}

clang/include/clang/Basic/AttrDocs.td

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9642,3 +9642,43 @@ silence diagnostics with code like:
96429642
__attribute__((nonstring)) char NotAStr[3] = "foo"; // Not diagnosed
96439643
}];
96449644
}
9645+
9646+
def ModularFormatDocs : Documentation {
9647+
let Category = DocCatFunction;
9648+
let Content = [{
9649+
The ``modular_format`` attribute can be applied to a function that bears the
9650+
``format`` attribute (or standard library functions) to indicate that the
9651+
implementation is "modular", that is, that the implementation is logically
9652+
divided into a number of named aspects. When the compiler can determine that
9653+
not all aspects of the implementation are needed for a given call, the compiler
9654+
may redirect the call to the identifier given as the first argument to the
9655+
attribute (the modular implementation function).
9656+
9657+
The second argument is a implementation name, and the remaining arguments are
9658+
aspects of the format string for the compiler to report. The implementation
9659+
name is an unevaluated identifier be in the C namespace.
9660+
9661+
The compiler reports that a call requires an aspect by issuing a relocation for
9662+
the symbol ``<impl_name>_<aspect>`` at the point of the call. This arranges for
9663+
code and data needed to support the aspect of the implementation to be brought
9664+
into the link to satisfy weak references in the modular implemenation function.
9665+
If the compiler does not understand an aspect, it must summarily consider any
9666+
call to require that aspect.
9667+
9668+
For example, say ``printf`` is annotated with
9669+
``modular_format(__modular_printf, "__printf", "float")``. Then, a call to
9670+
``printf(var, 42)`` would be untouched. A call to ``printf("%d", 42)`` would
9671+
become a call to ``__modular_printf`` with the same arguments, as would
9672+
``printf("%f", 42.0)``. The latter would be accompanied with a strong
9673+
relocation against the symbol ``__printf_float``, which would bring floating
9674+
point support for ``printf`` into the link.
9675+
9676+
If the attribute appears more than once on a declaration, or across a chain of
9677+
redeclarations, it is an error for the attributes to have different arguments,
9678+
excepting that the aspects may be in any order.
9679+
9680+
The following aspects are currently supported:
9681+
9682+
- ``float``: The call has a floating point argument
9683+
}];
9684+
}

clang/include/clang/Basic/BuiltinsX86.td

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3148,28 +3148,28 @@ let Features = "avx512bw", Attributes = [NoThrow, Const, Constexpr] in {
31483148
def kxordi : X86Builtin<"unsigned long long int(unsigned long long int, unsigned long long int)">;
31493149
}
31503150

3151-
let Features = "avx512dq", Attributes = [NoThrow, Const] in {
3151+
let Features = "avx512dq", Attributes = [NoThrow, Const, Constexpr] in {
31523152
def kshiftliqi : X86Builtin<"unsigned char(unsigned char, _Constant unsigned int)">;
31533153
}
31543154

3155-
let Features = "avx512f", Attributes = [NoThrow, Const] in {
3155+
let Features = "avx512f", Attributes = [NoThrow, Const, Constexpr] in {
31563156
def kshiftlihi : X86Builtin<"unsigned short(unsigned short, _Constant unsigned int)">;
31573157
}
31583158

3159-
let Features = "avx512bw", Attributes = [NoThrow, Const] in {
3159+
let Features = "avx512bw", Attributes = [NoThrow, Const, Constexpr] in {
31603160
def kshiftlisi : X86Builtin<"unsigned int(unsigned int, _Constant unsigned int)">;
31613161
def kshiftlidi : X86Builtin<"unsigned long long int(unsigned long long int, _Constant unsigned int)">;
31623162
}
31633163

3164-
let Features = "avx512dq", Attributes = [NoThrow, Const] in {
3164+
let Features = "avx512dq", Attributes = [NoThrow, Const, Constexpr] in {
31653165
def kshiftriqi : X86Builtin<"unsigned char(unsigned char, _Constant unsigned int)">;
31663166
}
31673167

3168-
let Features = "avx512f", Attributes = [NoThrow, Const] in {
3168+
let Features = "avx512f", Attributes = [NoThrow, Const, Constexpr] in {
31693169
def kshiftrihi : X86Builtin<"unsigned short(unsigned short, _Constant unsigned int)">;
31703170
}
31713171

3172-
let Features = "avx512bw", Attributes = [NoThrow, Const] in {
3172+
let Features = "avx512bw", Attributes = [NoThrow, Const, Constexpr] in {
31733173
def kshiftrisi : X86Builtin<"unsigned int(unsigned int, _Constant unsigned int)">;
31743174
def kshiftridi : X86Builtin<"unsigned long long int(unsigned long long int, _Constant unsigned int)">;
31753175
}

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11273,6 +11273,8 @@ def warn_duplicate_attribute_exact : Warning<
1127311273
def warn_duplicate_attribute : Warning<
1127411274
"attribute %0 is already applied with different arguments">,
1127511275
InGroup<IgnoredAttributes>;
11276+
def err_duplicate_attribute
11277+
: Error<"attribute %0 is already applied with different arguments">;
1127611278
def err_disallowed_duplicate_attribute : Error<
1127711279
"attribute %0 cannot appear more than once on a declaration">;
1127811280

@@ -13070,6 +13072,12 @@ def err_get_vtable_pointer_requires_complete_type
1307013072
: Error<"__builtin_get_vtable_pointer requires an argument with a complete "
1307113073
"type, but %0 is incomplete">;
1307213074

13075+
def err_modular_format_attribute_no_format
13076+
: Error<"'modular_format' attribute requires 'format' attribute">;
13077+
13078+
def err_modular_format_duplicate_aspect
13079+
: Error<"duplicate aspect '%0' in 'modular_format' attribute">;
13080+
1307313081
// SYCL-specific diagnostics
1307413082
def warn_sycl_kernel_num_of_template_params : Warning<
1307513083
"'sycl_kernel' attribute only applies to a function template with at least"

clang/include/clang/CIR/MissingFeatures.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,10 @@ struct MissingFeatures {
190190
static bool globalCtorAssociatedData() { return false; }
191191

192192
// Misc
193+
static bool aarch64SIMDIntrinsics() { return false; }
194+
static bool aarch64SMEIntrinsics() { return false; }
195+
static bool aarch64SVEIntrinsics() { return false; }
196+
static bool aarch64TblBuiltinExpr() { return false; }
193197
static bool abiArgInfo() { return false; }
194198
static bool addAutoInitAnnotation() { return false; }
195199
static bool addHeapAllocSiteMetadata() { return false; }
@@ -293,6 +297,7 @@ struct MissingFeatures {
293297
static bool metaDataNode() { return false; }
294298
static bool moduleNameHash() { return false; }
295299
static bool msabi() { return false; }
300+
static bool neonSISDIntrinsics() { return false; }
296301
static bool nrvo() { return false; }
297302
static bool objCBlocks() { return false; }
298303
static bool objCGC() { return false; }

0 commit comments

Comments
 (0)