Skip to content

Commit 9f0c2aa

Browse files
committed
Merge remote-tracking branch 'origin/main' into until
2 parents 2596148 + 153dd19 commit 9f0c2aa

File tree

732 files changed

+19231
-4735
lines changed

Some content is hidden

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

732 files changed

+19231
-4735
lines changed

.ci/metrics/metrics.py

Lines changed: 53 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ class JobMetrics:
2424
status: int
2525
created_at_ns: int
2626
workflow_id: int
27+
workflow_name: str
2728

2829

2930
@dataclass
@@ -43,40 +44,60 @@ def get_sampled_workflow_metrics(github_repo: github.Repository):
4344
Returns a list of GaugeMetric objects, containing the relevant metrics about
4445
the workflow
4546
"""
47+
queued_job_counts = {}
48+
running_job_counts = {}
4649

4750
# Other states are available (pending, waiting, etc), but the meaning
4851
# is not documented (See #70540).
4952
# "queued" seems to be the info we want.
50-
queued_workflow_count = len(
51-
[
52-
x
53-
for x in github_repo.get_workflow_runs(status="queued")
54-
if x.name in WORKFLOWS_TO_TRACK
55-
]
56-
)
57-
running_workflow_count = len(
58-
[
59-
x
60-
for x in github_repo.get_workflow_runs(status="in_progress")
61-
if x.name in WORKFLOWS_TO_TRACK
62-
]
63-
)
53+
for queued_workflow in github_repo.get_workflow_runs(status="queued"):
54+
if queued_workflow.name not in WORKFLOWS_TO_TRACK:
55+
continue
56+
for queued_workflow_job in queued_workflow.jobs():
57+
job_name = queued_workflow_job.name
58+
# Workflows marked as queued can potentially only have some jobs
59+
# queued, so make sure to also count jobs currently in progress.
60+
if queued_workflow_job.status == "queued":
61+
if job_name not in queued_job_counts:
62+
queued_job_counts[job_name] = 1
63+
else:
64+
queued_job_counts[job_name] += 1
65+
elif queued_workflow_job.status == "in_progress":
66+
if job_name not in running_job_counts:
67+
running_job_counts[job_name] = 1
68+
else:
69+
running_job_counts[job_name] += 1
70+
71+
for running_workflow in github_repo.get_workflow_runs(status="in_progress"):
72+
if running_workflow.name not in WORKFLOWS_TO_TRACK:
73+
continue
74+
for running_workflow_job in running_workflow.jobs():
75+
job_name = running_workflow_job.name
76+
if running_workflow_job.status != "in_progress":
77+
continue
78+
79+
if job_name not in running_job_counts:
80+
running_job_counts[job_name] = 1
81+
else:
82+
running_job_counts[job_name] += 1
6483

6584
workflow_metrics = []
66-
workflow_metrics.append(
67-
GaugeMetric(
68-
"workflow_queue_size",
69-
queued_workflow_count,
70-
time.time_ns(),
85+
for queued_job in queued_job_counts:
86+
workflow_metrics.append(
87+
GaugeMetric(
88+
f"workflow_queue_size_{queued_job}",
89+
queued_job_counts[queued_job],
90+
time.time_ns(),
91+
)
7192
)
72-
)
73-
workflow_metrics.append(
74-
GaugeMetric(
75-
"running_workflow_count",
76-
running_workflow_count,
77-
time.time_ns(),
93+
for running_job in running_job_counts:
94+
workflow_metrics.append(
95+
GaugeMetric(
96+
f"running_workflow_count_{running_job}",
97+
running_job_counts[running_job],
98+
time.time_ns(),
99+
)
78100
)
79-
)
80101
# Always send a hearbeat metric so we can monitor is this container is still able to log to Grafana.
81102
workflow_metrics.append(
82103
GaugeMetric("metrics_container_heartbeat", 1, time.time_ns())
@@ -157,7 +178,7 @@ def get_per_workflow_metrics(
157178
# longer in a testing state and we can directly assert the workflow
158179
# result.
159180
for step in workflow_job.steps:
160-
if step.conclusion != "success":
181+
if step.conclusion != "success" and step.conclusion != "skipped":
161182
job_result = 0
162183
break
163184

@@ -179,6 +200,7 @@ def get_per_workflow_metrics(
179200
job_result,
180201
created_at_ns,
181202
workflow_run.id,
203+
workflow_run.name,
182204
)
183205
)
184206

@@ -235,8 +257,6 @@ def upload_metrics(workflow_metrics, metrics_userid, api_key):
235257
def main():
236258
# Authenticate with Github
237259
auth = Auth.Token(os.environ["GITHUB_TOKEN"])
238-
github_object = Github(auth=auth)
239-
github_repo = github_object.get_repo("llvm/llvm-project")
240260

241261
grafana_api_key = os.environ["GRAFANA_API_KEY"]
242262
grafana_metrics_userid = os.environ["GRAFANA_METRICS_USERID"]
@@ -248,20 +268,19 @@ def main():
248268
# Enter the main loop. Every five minutes we wake up and dump metrics for
249269
# the relevant jobs.
250270
while True:
271+
github_object = Github(auth=auth)
272+
github_repo = github_object.get_repo("llvm/llvm-project")
273+
251274
current_metrics = get_per_workflow_metrics(github_repo, workflows_to_track)
252275
current_metrics += get_sampled_workflow_metrics(github_repo)
253-
# Always send a hearbeat metric so we can monitor is this container is still able to log to Grafana.
254-
current_metrics.append(
255-
GaugeMetric("metrics_container_heartbeat", 1, time.time_ns())
256-
)
257276

258277
upload_metrics(current_metrics, grafana_metrics_userid, grafana_api_key)
259278
print(f"Uploaded {len(current_metrics)} metrics", file=sys.stderr)
260279

261280
for workflow_metric in reversed(current_metrics):
262281
if isinstance(workflow_metric, JobMetrics):
263282
workflows_to_track[
264-
workflow_metric.job_name
283+
workflow_metric.workflow_name
265284
] = workflow_metric.workflow_id
266285

267286
time.sleep(SCRAPE_INTERVAL_SECONDS)

.github/workflows/premerge.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ jobs:
144144
call C:\\BuildTools\\Common7\\Tools\\VsDevCmd.bat -arch=amd64 -host_arch=amd64
145145
bash .ci/monolithic-windows.sh "${{ steps.vars.outputs.windows-projects }}" "${{ steps.vars.outputs.windows-check-targets }}"
146146
147-
permerge-check-macos:
147+
premerge-check-macos:
148148
runs-on: macos-14
149149
if: >-
150150
github.repository_owner == 'llvm' &&

.github/workflows/release-binaries.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,13 +133,13 @@ jobs:
133133
# add extra CMake args to disable them.
134134
# See https://github.com/llvm/llvm-project/issues/99767
135135
if [ "$RUNNER_OS" = "macOS" ]; then
136-
target_cmake_flags="$target_cmake_flags -DBOOTSTRAP_COMPILER_RT_ENABLE_IOS=OFF"
136+
target_cmake_flags="$target_cmake_flags -DBOOTSTRAP_BOOTSTRAP_COMPILER_RT_ENABLE_IOS=OFF"
137137
if [ "$RUNNER_ARCH" = "ARM64" ]; then
138138
arches=arm64
139139
else
140140
arches=x86_64
141141
fi
142-
target_cmake_flags="$target_cmake_flags -DBOOTSTRAP_DARWIN_osx_ARCHS=$arches -DBOOTSTRAP_DARWIN_osx_BUILTIN_ARCHS=$arches"
142+
target_cmake_flags="$target_cmake_flags -DBOOTSTRAP_BOOTSTRAP_DARWIN_osx_ARCHS=$arches -DBOOTSTRAP_BOOTSTRAP_DARWIN_osx_BUILTIN_ARCHS=$arches"
143143
fi
144144
145145
build_flang="true"

clang-tools-extra/clang-tidy/bugprone/VirtualNearMissCheck.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,15 +179,15 @@ static bool checkOverrideByDerivedMethod(const CXXMethodDecl *BaseMD,
179179

180180
bool VirtualNearMissCheck::isPossibleToBeOverridden(
181181
const CXXMethodDecl *BaseMD) {
182-
auto Iter = PossibleMap.find(BaseMD);
183-
if (Iter != PossibleMap.end())
182+
auto [Iter, Inserted] = PossibleMap.try_emplace(BaseMD);
183+
if (!Inserted)
184184
return Iter->second;
185185

186186
bool IsPossible = !BaseMD->isImplicit() && !isa<CXXConstructorDecl>(BaseMD) &&
187187
!isa<CXXDestructorDecl>(BaseMD) && BaseMD->isVirtual() &&
188188
!BaseMD->isOverloadedOperator() &&
189189
!isa<CXXConversionDecl>(BaseMD);
190-
PossibleMap[BaseMD] = IsPossible;
190+
Iter->second = IsPossible;
191191
return IsPossible;
192192
}
193193

clang/docs/LanguageExtensions.rst

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2866,6 +2866,47 @@ etc.).
28662866
28672867
Query for this feature with ``__has_builtin(__builtin_assume_separate_storage)``.
28682868
2869+
``__builtin_assume_dereferenceable``
2870+
-------------------------------------
2871+
2872+
``__builtin_assume_dereferenceable`` is used to provide the optimizer with the
2873+
knowledge that the pointer argument P is dereferenceable up to at least the
2874+
specified number of bytes.
2875+
2876+
**Syntax**:
2877+
2878+
.. code-block:: c++
2879+
2880+
__builtin_assume_dereferenceable(const void *, size_t)
2881+
2882+
**Example of Use**:
2883+
2884+
.. code-block:: c++
2885+
2886+
int foo(int *x, int y) {
2887+
__builtin_assume_dereferenceable(x, sizeof(int));
2888+
int z = 0;
2889+
if (y == 1) {
2890+
// The optimizer may execute the load of x unconditionally due to
2891+
// __builtin_assume_dereferenceable guaranteeing sizeof(int) bytes can
2892+
// be loaded speculatively without trapping.
2893+
z = *x;
2894+
}
2895+
return z;
2896+
}
2897+
2898+
**Description**:
2899+
2900+
The arguments to this function provide a start pointer ``P`` and a size ``S``.
2901+
``S`` must be at least 1 and a constant. The optimizer may assume that ``S``
2902+
bytes are dereferenceable starting at ``P``. Note that this does not necessarily
2903+
imply that ``P`` is non-null as ``nullptr`` can be dereferenced in some cases.
2904+
The assumption also does not imply that ``P`` is not dereferenceable past ``S``
2905+
bytes.
2906+
2907+
2908+
Query for this feature with ``__has_builtin(__builtin_assume_dereferenceable)``.
2909+
28692910
28702911
``__builtin_offsetof``
28712912
----------------------

clang/docs/ReleaseNotes.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ C Language Changes
9393

9494
- Clang now allows an ``inline`` specifier on a typedef declaration of a
9595
function type in Microsoft compatibility mode. #GH124869
96+
- Clang now allows ``restrict`` qualifier for array types with pointer elements (#GH92847).
9697

9798
C2y Feature Support
9899
^^^^^^^^^^^^^^^^^^^
@@ -124,6 +125,10 @@ Attribute Changes in Clang
124125

125126
- The ``no_sanitize`` attribute now accepts both ``gnu`` and ``clang`` names.
126127
- Clang now diagnoses use of declaration attributes on void parameters. (#GH108819)
128+
- Clang now allows ``__attribute__((model("small")))`` and
129+
``__attribute__((model("large")))`` on non-TLS globals in x86-64 compilations.
130+
This forces the global to be considered small or large in regards to the
131+
x86-64 code model, regardless of the code model specified for the compilation.
127132

128133
Improvements to Clang's diagnostics
129134
-----------------------------------
@@ -265,6 +270,10 @@ Code Completion
265270
Static Analyzer
266271
---------------
267272

273+
- Clang currently support extending lifetime of object bound to
274+
reference members of aggregates in CFG and ExprEngine, that are
275+
created from default member initializer.
276+
268277
New features
269278
^^^^^^^^^^^^
270279

clang/include/clang/AST/OperationKinds.def

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,9 @@ CAST_OPERATION(HLSLArrayRValue)
370370
// Aggregate by Value cast (HLSL only).
371371
CAST_OPERATION(HLSLElementwiseCast)
372372

373+
// Splat cast for Aggregates (HLSL only).
374+
CAST_OPERATION(HLSLAggregateSplatCast)
375+
373376
//===- Binary Operations -------------------------------------------------===//
374377
// Operators listed in order of precedence.
375378
// Note that additions to this should also update the StmtVisitor class,

clang/include/clang/AST/Redeclarable.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,6 @@ class Redeclarable {
114114

115115
bool isFirst() const {
116116
return isa<KnownLatest>(Link) ||
117-
// FIXME: 'template' is required on the next line due to an
118-
// apparent clang bug.
119117
isa<UninitializedLatest>(cast<NotKnownLatest>(Link));
120118
}
121119

clang/include/clang/Basic/Attr.td

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,7 @@ class TargetArch<list<string> arches> : TargetSpec {
459459
}
460460
def TargetARM : TargetArch<["arm", "thumb", "armeb", "thumbeb"]>;
461461
def TargetAArch64 : TargetArch<["aarch64", "aarch64_be", "aarch64_32"]>;
462+
def TargetAMDGPU : TargetArch<["amdgcn", "r600"]>;
462463
def TargetAnyArm : TargetArch<!listconcat(TargetARM.Arches, TargetAArch64.Arches)>;
463464
def TargetAVR : TargetArch<["avr"]>;
464465
def TargetBPF : TargetArch<["bpfel", "bpfeb"]>;
@@ -469,7 +470,9 @@ def TargetMSP430 : TargetArch<["msp430"]>;
469470
def TargetM68k : TargetArch<["m68k"]>;
470471
def TargetRISCV : TargetArch<["riscv32", "riscv64"]>;
471472
def TargetX86 : TargetArch<["x86"]>;
473+
def TargetX86_64 : TargetArch<["x86_64"]>;
472474
def TargetAnyX86 : TargetArch<["x86", "x86_64"]>;
475+
def TargetSPIRV : TargetArch<["spirv", "spirv32", "spirv64"]>;
473476
def TargetWebAssembly : TargetArch<["wasm32", "wasm64"]>;
474477
def TargetNVPTX : TargetArch<["nvptx", "nvptx64"]>;
475478
def TargetWindows : TargetSpec {
@@ -3124,11 +3127,20 @@ def PragmaClangTextSection : InheritableAttr {
31243127
let Documentation = [InternalOnly];
31253128
}
31263129

3127-
def CodeModel : InheritableAttr, TargetSpecificAttr<TargetLoongArch> {
3130+
// The code model attribute only applies to LoongArch and x86-64, but for NVPTX
3131+
// compilations that share code with the host, we want to ignore the attribute
3132+
// rather than warn on it.
3133+
def CodeModel
3134+
: InheritableAttr,
3135+
TargetSpecificAttr<TargetArch<!listconcat(
3136+
TargetLoongArch.Arches, TargetX86_64.Arches, TargetNVPTX.Arches,
3137+
TargetAMDGPU.Arches, TargetSPIRV.Arches)>> {
31283138
let Spellings = [GCC<"model">];
3129-
let Args = [EnumArgument<"Model", "llvm::CodeModel::Model", /*is_string=*/1,
3130-
["normal", "medium", "extreme"], ["Small", "Medium", "Large"],
3131-
/*opt=*/0, /*fake=*/0, /*isExternalType=*/1, /*isCovered=*/0>];
3139+
let Args = [EnumArgument<
3140+
"Model", "llvm::CodeModel::Model",
3141+
/*is_string=*/1, ["small", "normal", "medium", "large", "extreme"],
3142+
["Small", "Small", "Medium", "Large", "Large"],
3143+
/*opt=*/0, /*fake=*/0, /*isExternalType=*/1, /*isCovered=*/0>];
31323144
let Subjects = SubjectList<[NonTLSGlobalVar], ErrorDiag>;
31333145
let Documentation = [CodeModelDocs];
31343146
}

clang/include/clang/Basic/AttrDocs.td

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,16 @@ def CodeModelDocs : Documentation {
6262
let Content = [{
6363
The ``model`` attribute allows overriding the translation unit's
6464
code model (specified by ``-mcmodel``) for a specific global variable.
65+
66+
On LoongArch, allowed values are "normal", "medium", "extreme".
67+
68+
On x86-64, allowed values are ``"small"`` and ``"large"``. ``"small"`` is
69+
roughly equivalent to ``-mcmodel=small``, meaning the global is considered
70+
"small" placed closer to the ``.text`` section relative to "large" globals, and
71+
to prefer using 32-bit relocations to access the global. ``"large"`` is roughly
72+
equivalent to ``-mcmodel=large``, meaning the global is considered "large" and
73+
placed further from the ``.text`` section relative to "small" globals, and
74+
64-bit relocations must be used to access the global.
6575
}];
6676
let Heading = "model";
6777
}
@@ -8482,7 +8492,7 @@ that is a pointer to the type with the attribute.
84828492
}
84838493

84848494
The above example will result in a call to ``bar`` being passed the address of
8485-
`y`` when ``y`` goes out of scope, then a call to ``foo`` being passed the
8495+
``y`` when ``y`` goes out of scope, then a call to ``foo`` being passed the
84868496
address of ``x`` when ``x`` goes out of scope. If two or more variables share
84878497
the same scope, their ``cleanup`` callbacks are invoked in the reverse order
84888498
the variables were declared in. It is not possible to check the return value

clang/include/clang/Basic/Builtins.td

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -839,6 +839,12 @@ def BuiltinAssumeAligned : Builtin {
839839
let Prototype = "void*(void const*, size_t, ...)";
840840
}
841841

842+
def BuiltinAssumeDereferenceable : Builtin {
843+
let Spellings = ["__builtin_assume_dereferenceable"];
844+
let Attributes = [NoThrow, Const];
845+
let Prototype = "void(void const*, _Constant size_t)";
846+
}
847+
842848
def BuiltinFree : Builtin {
843849
let Spellings = ["__builtin_free"];
844850
let Attributes = [FunctionWithBuiltinPrefix, NoThrow];

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7413,6 +7413,11 @@ def warn_c23_compat_utf8_string : Warning<
74137413
def note_cxx20_c23_compat_utf8_string_remove_u8 : Note<
74147414
"remove 'u8' prefix to avoid a change of behavior; "
74157415
"Clang encodes unprefixed narrow string literals as UTF-8">;
7416+
def warn_c23_compat_restrict_on_array_of_pointers : Warning<
7417+
"'restrict' qualifier on an array of pointers is incompatible with C standards before C23">,
7418+
InGroup<CPre23Compat>, DefaultIgnore;
7419+
def ext_restrict_on_array_of_pointers_c23 : Extension<
7420+
"'restrict' qualifier on an array of pointers is a C23 extension">, InGroup<C23>;
74167421
def err_array_init_different_type : Error<
74177422
"cannot initialize array %diff{of type $ with array of type $|"
74187423
"with different type of array}0,1">;
@@ -12621,6 +12626,9 @@ def err_hlsl_pointers_unsupported : Error<
1262112626
"%select{pointers|references}0 are unsupported in HLSL">;
1262212627
def err_hlsl_missing_resource_class : Error<"HLSL resource needs to have [[hlsl::resource_class()]] attribute">;
1262312628
def err_hlsl_attribute_needs_intangible_type: Error<"attribute %0 can be used only on HLSL intangible type %1">;
12629+
def err_hlsl_incorrect_num_initializers: Error<
12630+
"too %select{few|many}0 initializers in list for type %1 "
12631+
"(expected %2 but found %3)">;
1262412632

1262512633
def err_hlsl_operator_unsupported : Error<
1262612634
"the '%select{&|*|->}0' operator is unsupported in HLSL">;

0 commit comments

Comments
 (0)