Skip to content

Commit f409232

Browse files
committed
Merge remote-tracking branch 'origin/main' into vplan-max-cost-sentinel
2 parents 8117ba1 + 67c0846 commit f409232

File tree

4,355 files changed

+226846
-102946
lines changed

Some content is hidden

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

4,355 files changed

+226846
-102946
lines changed

.github/workflows/libcxx-build-and-test.yaml

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -193,17 +193,24 @@ jobs:
193193
**/crash_diagnostics/*
194194
195195
macos:
196-
runs-on: macos-14
197196
needs: [ stage1 ]
198197
strategy:
199-
fail-fast: true
198+
fail-fast: false
200199
matrix:
201-
config: [
202-
generic-cxx03,
203-
generic-cxx23,
204-
generic-modules,
205-
apple-configuration
206-
]
200+
include:
201+
- config: generic-cxx03
202+
os: macos-latest
203+
- config: generic-cxx23
204+
os: macos-latest
205+
- config: generic-modules
206+
os: macos-latest
207+
- config: apple-configuration
208+
os: macos-latest
209+
- config: apple-system
210+
os: macos-13
211+
- config: apple-system-hardened
212+
os: macos-13
213+
runs-on: ${{ matrix.os }}
207214
steps:
208215
- uses: actions/checkout@v4
209216
- uses: maxim-lobanov/setup-xcode@v1

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ on:
4343
- '.github/workflows/release-binaries.yml'
4444
- '.github/workflows/release-binaries-setup-stage/*'
4545
- '.github/workflows/release-binaries-save-stage/*'
46+
- 'clang/cmake/caches/Release.cmake'
4647

4748
concurrency:
4849
group: ${{ github.workflow }}-${{ github.event.pull_request.number || 'dispatch' }}

.github/workflows/release-binaries.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,14 @@ jobs:
420420
attestations: write # For artifact attestations
421421

422422
steps:
423+
- name: Checkout Release Scripts
424+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
425+
with:
426+
sparse-checkout: |
427+
llvm/utils/release/github-upload-release.py
428+
llvm/utils/git/requirements.txt
429+
sparse-checkout-cone-mode: false
430+
423431
- name: 'Download artifact'
424432
uses: actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1
425433
with:
@@ -442,14 +450,6 @@ jobs:
442450
name: ${{ needs.prepare.outputs.release-binary-filename }}-attestation
443451
path: ${{ needs.prepare.outputs.release-binary-filename }}.jsonl
444452

445-
- name: Checkout Release Scripts
446-
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
447-
with:
448-
sparse-checkout: |
449-
llvm/utils/release/github-upload-release.py
450-
llvm/utils/git/requirements.txt
451-
sparse-checkout-cone-mode: false
452-
453453
- name: Install Python Requirements
454454
run: |
455455
pip install --require-hashes -r ./llvm/utils/git/requirements.txt

.github/workflows/release-documentation.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,17 +72,20 @@ jobs:
7272
ref: main
7373
fetch-depth: 0
7474
path: www-releases
75+
persist-credentials: false
7576

7677
- name: Upload Release Notes
7778
if: env.upload
7879
env:
79-
WWW_RELEASES_TOKEN: ${{ secrets.WWW_RELEASES_TOKEN }}
80+
GH_TOKEN: ${{ secrets.WWW_RELEASES_TOKEN }}
8081
run: |
81-
mkdir -p ../www-releases/${{ inputs.release-version }}
82-
mv ./docs-build/html-export/* ../www-releases/${{ inputs.release-version }}
83-
cd ../www-releases
82+
mkdir -p www-releases/${{ inputs.release-version }}
83+
mv ./docs-build/html-export/* www-releases/${{ inputs.release-version }}
84+
cd www-releases
85+
git checkout -b ${{ inputs.release-version }}
8486
git add ${{ inputs.release-version }}
8587
git config user.email "[email protected]"
8688
git config user.name "llvmbot"
8789
git commit -a -m "Add ${{ inputs.release-version }} documentation"
88-
git push "https://[email protected]/${{ github.repository_owner }}/www-releases" main:main
90+
git push --force "https://[email protected]/llvmbot/www-releases.git" HEAD:refs/heads/${{ inputs.release-version }}
91+
gh pr create -f -B main -H ${{ inputs.release-version }} -R llvmbot/www-releases

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ autoconf/autom4te.cache
5151
/CMakeSettings.json
5252
# CLion project configuration
5353
/.idea
54+
/cmake-build*
5455

5556
#==============================================================================#
5657
# Directories to ignore (do not add trailing '/'s, they skip symlinks).

bolt/include/bolt/Core/BinaryData.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,6 @@ inline raw_ostream &operator<<(raw_ostream &OS,
226226
Sep = ",\n ";
227227
TotalCount += AccessInfo.Count;
228228
}
229-
SS.flush();
230229

231230
OS << TotalCount << " total counts : " << TempString;
232231
return OS;

bolt/include/bolt/Core/BinaryFunction.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@ inline raw_ostream &operator<<(raw_ostream &OS,
117117
TotalCount += CSP.Count;
118118
TotalMispreds += CSP.Mispreds;
119119
}
120-
SS.flush();
121120

122121
OS << TotalCount << " (" << TotalMispreds << " misses) :" << TempString;
123122
return OS;

bolt/lib/Core/BinaryFunction.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,12 @@ bool shouldPrint(const BinaryFunction &Function) {
165165
}
166166
}
167167

168+
std::optional<StringRef> Origin = Function.getOriginSectionName();
169+
if (Origin && llvm::any_of(opts::PrintOnly, [&](const std::string &Name) {
170+
return Name == *Origin;
171+
}))
172+
return true;
173+
168174
return false;
169175
}
170176

bolt/lib/Passes/RetpolineInsertion.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,6 @@ std::string createRetpolineFunctionTag(BinaryContext &BC,
181181
if (BrInfo.isReg()) {
182182
BC.InstPrinter->printRegName(TagOS, BrInfo.BranchReg);
183183
TagOS << "_";
184-
TagOS.flush();
185184
return Tag;
186185
}
187186

@@ -212,7 +211,6 @@ std::string createRetpolineFunctionTag(BinaryContext &BC,
212211
BC.InstPrinter->printRegName(TagOS, MemRef.SegRegNum);
213212
}
214213

215-
TagOS.flush();
216214
return Tag;
217215
}
218216

bolt/lib/Rewrite/RewriteInstance.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4245,7 +4245,6 @@ void RewriteInstance::addBoltInfoSection() {
42454245
<< "command line:";
42464246
for (int I = 0; I < Argc; ++I)
42474247
DescOS << " " << Argv[I];
4248-
DescOS.flush();
42494248

42504249
// Encode as GNU GOLD VERSION so it is easily printable by 'readelf -n'
42514250
const std::string BoltInfo =
@@ -4268,7 +4267,6 @@ void RewriteInstance::encodeBATSection() {
42684267
raw_string_ostream DescOS(DescStr);
42694268

42704269
BAT->write(*BC, DescOS);
4271-
DescOS.flush();
42724270

42734271
const std::string BoltInfo =
42744272
BinarySection::encodeELFNote("BOLT", DescStr, BinarySection::NT_BOLT_BAT);

bolt/lib/RuntimeLibs/InstrumentationRuntimeLibrary.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,6 @@ std::string InstrumentationRuntimeLibrary::buildTables(BinaryContext &BC) {
314314
}
315315
// Our string table lives immediately after descriptions vector
316316
OS << Summary->StringTable;
317-
OS.flush();
318317

319318
return TablesStr;
320319
}

bolt/test/AArch64/constant_island_pie_update.s

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@
88
# RUN: %clang %cflags -fPIC -pie %t.o -o %t.rela.exe -nostdlib \
99
# RUN: -Wl,-q -Wl,-z,notext
1010
# RUN: llvm-bolt %t.rela.exe -o %t.rela.bolt --use-old-text=0 --lite=0
11-
# RUN: llvm-objdump -j .text -d --show-all-symbols %t.rela.bolt | FileCheck %s
11+
# RUN: llvm-objdump -j .text -d -z --show-all-symbols %t.rela.bolt | FileCheck %s
1212
# RUN: llvm-readelf -rsW %t.rela.bolt | FileCheck --check-prefix=ELFCHECK %s
1313
// .relr.dyn
1414
# RUN: %clang %cflags -fPIC -pie %t.o -o %t.relr.exe -nostdlib \
1515
# RUN: -Wl,-q -Wl,-z,notext -Wl,--pack-dyn-relocs=relr
1616
# RUN: llvm-objcopy --remove-section .rela.mytext %t.relr.exe
1717
# RUN: llvm-bolt %t.relr.exe -o %t.relr.bolt --use-old-text=0 --lite=0
18-
# RUN: llvm-objdump -j .text -d --show-all-symbols %t.relr.bolt | FileCheck %s
19-
# RUN: llvm-objdump -j .text -d %t.relr.bolt | \
18+
# RUN: llvm-objdump -j .text -d -z --show-all-symbols %t.relr.bolt | FileCheck %s
19+
# RUN: llvm-objdump -j .text -d -z %t.relr.bolt | \
2020
# RUN: FileCheck %s --check-prefix=ADDENDCHECK
2121
# RUN: llvm-readelf -rsW %t.relr.bolt | FileCheck --check-prefix=RELRELFCHECK %s
2222
# RUN: llvm-readelf -SW %t.relr.bolt | FileCheck --check-prefix=RELRSZCHECK %s

bolt/test/AArch64/update-weak-reference-symbol.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// RUN: %clang %cflags -Wl,-z,notext -shared -Wl,-q %s -o %t.so
44
// RUN: llvm-bolt %t.so -o %t.so.bolt
55
// RUN: llvm-nm -n %t.so.bolt > %t.out.txt
6-
// RUN: llvm-objdump -dj .rodata %t.so.bolt >> %t.out.txt
6+
// RUN: llvm-objdump -z -dj .rodata %t.so.bolt >> %t.out.txt
77
// RUN: FileCheck %s --input-file=%t.out.txt
88

99
# CHECK: w func_1

bolt/test/X86/log.test

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ RUN: yaml2obj %p/Inputs/blarge.yaml &> %t.exe
66
RUN: llvm-bolt %t.exe -o %t.null --data %p/Inputs/blarge.fdata -v=2 \
77
RUN: --reorder-blocks=normal --print-finalized --log-file=%t.log 2>&1 \
88
RUN: | FileCheck --check-prefix=CHECK --allow-empty %s
9-
RUN: cat %t.log | FileCheck %s --check-prefix=CHECK-LOG
9+
RUN: FileCheck %s --check-prefix=CHECK-LOG --input-file %t.log
1010

1111
CHECK-NOT: BOLT-INFO
1212
CHECK-NOT: BOLT-WARNING
@@ -16,4 +16,4 @@ CHECK-NOT: BOLT-ERROR
1616
CHECK-LOG: BOLT-INFO: Target architecture
1717
CHECK-LOG: BOLT-INFO: BOLT version
1818
CHECK-LOG: BOLT-INFO: basic block reordering modified layout
19-
CHECK-LOG: Binary Function "usqrt"
19+
CHECK-LOG: Binary Function "main"

bolt/test/X86/print-only-section.s

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
## Check that --print-only flag works with sections.
2+
3+
# REQUIRES: system-linux
4+
5+
# RUN: llvm-mc -filetype=obj -triple x86_64-unknown-linux %s -o %t.o
6+
# RUN: ld.lld %t.o -o %t.exe
7+
# RUN: llvm-bolt %t.exe -o %t.out --print-cfg --print-only=unused_code 2>&1 \
8+
# RUN: | FileCheck %s
9+
10+
# CHECK: Binary Function "foo"
11+
# CHECK-NOT: Binary Function "_start"
12+
13+
.text
14+
.globl _start
15+
.type _start, %function
16+
_start:
17+
.cfi_startproc
18+
ret
19+
.cfi_endproc
20+
.size _start, .-_start
21+
22+
.section unused_code,"ax",@progbits
23+
.globl foo
24+
.type foo, %function
25+
foo:
26+
.cfi_startproc
27+
ret
28+
.cfi_endproc
29+
.size foo, .-foo
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
## Test that merge-fdata correctly handles YAML header with an uninitialized
2+
## fields. a.yaml does not have hash-func set and it used to crash merge-fdata.
3+
4+
# REQUIRES: system-linux
5+
6+
# RUN: split-file %s %t
7+
# RUN: not merge-fdata %t/a.yaml %t/b.yaml 2>&1 | FileCheck %s
8+
9+
# CHECK: cannot merge profiles with different hash functions
10+
11+
#--- a.yaml
12+
---
13+
header:
14+
profile-version: 1
15+
binary-name: 'a.out'
16+
binary-build-id: '<unknown>'
17+
profile-flags: [ lbr ]
18+
profile-origin: branch profile reader
19+
profile-events: ''
20+
dfs-order: false
21+
functions:
22+
- name: 'main'
23+
fid: 1
24+
hash: 0x50BBA3441D436491
25+
exec: 1
26+
nblocks: 0
27+
...
28+
#--- b.yaml
29+
---
30+
header:
31+
profile-version: 1
32+
binary-name: 'a.out'
33+
binary-build-id: '<unknown>'
34+
profile-flags: [ lbr ]
35+
profile-origin: branch profile reader
36+
profile-events: ''
37+
dfs-order: false
38+
hash-func: xxh3
39+
functions:
40+
- name: 'main'
41+
fid: 1
42+
hash: 0x50BBA3441D436491
43+
exec: 1
44+
nblocks: 0
45+
...

bolt/test/perf2bolt/perf_test.test

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,12 @@
33
REQUIRES: system-linux, perf
44

55
RUN: %clang %S/Inputs/perf_test.c -fuse-ld=lld -Wl,--script=%S/Inputs/perf_test.lds -o %t
6-
RUN: perf record -e cycles:u -o %t2 -- %t
6+
RUN: perf record -Fmax -e cycles:u -o %t2 -- %t
77
RUN: perf2bolt %t -p=%t2 -o %t3 -nl -ignore-build-id 2>&1 | FileCheck %s
88

99
CHECK-NOT: PERF2BOLT-ERROR
1010
CHECK-NOT: !! WARNING !! This high mismatch ratio indicates the input binary is probably not the same binary used during profiling collection.
1111

1212
RUN: %clang %S/Inputs/perf_test.c -no-pie -fuse-ld=lld -o %t4
13-
RUN: perf record -e cycles:u -o %t5 -- %t4
14-
RUN: perf2bolt %t4 -p=%t5 -o %t6 -nl -ignore-build-id 2>&1 | FileCheck %s --check-prefix=CHECK-NO-PIE
15-
16-
CHECK-NO-PIE-NOT: PERF2BOLT-ERROR
17-
CHECK-NO-PIE-NOT: !! WARNING !! This high mismatch ratio indicates the input binary is probably not the same binary used during profiling collection.
13+
RUN: perf record -Fmax -e cycles:u -o %t5 -- %t4
14+
RUN: perf2bolt %t4 -p=%t5 -o %t6 -nl -ignore-build-id 2>&1 | FileCheck %s

bolt/tools/merge-fdata/merge-fdata.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,10 @@ void mergeProfileHeaders(BinaryProfileHeader &MergedHeader,
145145
errs() << "WARNING: merging profiles with different sampling events\n";
146146
MergedHeader.EventNames += "," + Header.EventNames;
147147
}
148+
149+
if (MergedHeader.HashFunction != Header.HashFunction)
150+
report_error("merge conflict",
151+
"cannot merge profiles with different hash functions");
148152
}
149153

150154
void mergeBasicBlockProfile(BinaryBasicBlockProfile &MergedBB,
@@ -386,6 +390,7 @@ int main(int argc, char **argv) {
386390
// Merged information for all functions.
387391
StringMap<BinaryFunctionProfile> MergedBFs;
388392

393+
bool FirstHeader = true;
389394
for (std::string &InputDataFilename : Inputs) {
390395
ErrorOr<std::unique_ptr<MemoryBuffer>> MB =
391396
MemoryBuffer::getFileOrSTDIN(InputDataFilename);
@@ -409,7 +414,12 @@ int main(int argc, char **argv) {
409414
}
410415

411416
// Merge the header.
412-
mergeProfileHeaders(MergedHeader, BP.Header);
417+
if (FirstHeader) {
418+
MergedHeader = BP.Header;
419+
FirstHeader = false;
420+
} else {
421+
mergeProfileHeaders(MergedHeader, BP.Header);
422+
}
413423

414424
// Do the function merge.
415425
for (BinaryFunctionProfile &BF : BP.Functions) {

clang-tools-extra/clang-move/tool/ClangMove.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ int main(int argc, const char **argv) {
199199
for (auto I = Files.begin(), E = Files.end(); I != E; ++I) {
200200
OS << " {\n";
201201
OS << " \"FilePath\": \"" << *I << "\",\n";
202-
const auto Entry = FileMgr.getFile(*I);
202+
const auto Entry = FileMgr.getOptionalFileRef(*I);
203203
auto ID = SM.translateFile(*Entry);
204204
std::string Content;
205205
llvm::raw_string_ostream ContentStream(Content);

clang-tools-extra/clang-tidy/ClangTidy.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -672,6 +672,18 @@ getAllChecksAndOptions(bool AllowEnablingAnalyzerAlphaCheckers) {
672672
Buffer.append(AnalyzerCheck);
673673
Result.Names.insert(Buffer);
674674
}
675+
for (std::string OptionName : {
676+
#define GET_CHECKER_OPTIONS
677+
#define CHECKER_OPTION(TYPE, CHECKER, OPTION_NAME, DESCRIPTION, DEFAULT, \
678+
RELEASE, HIDDEN) \
679+
Twine(AnalyzerCheckNamePrefix).concat(CHECKER ":" OPTION_NAME).str(),
680+
681+
#include "clang/StaticAnalyzer/Checkers/Checkers.inc"
682+
#undef CHECKER_OPTION
683+
#undef GET_CHECKER_OPTIONS
684+
}) {
685+
Result.Options.insert(OptionName);
686+
}
675687
#endif // CLANG_TIDY_ENABLE_STATIC_ANALYZER
676688

677689
Context.setOptionsCollector(&Result.Options);

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@
7878
#include "SuspiciousStringviewDataUsageCheck.h"
7979
#include "SwappedArgumentsCheck.h"
8080
#include "SwitchMissingDefaultCaseCheck.h"
81+
#include "TaggedUnionMemberCountCheck.h"
8182
#include "TerminatingContinueCheck.h"
8283
#include "ThrowKeywordMissingCheck.h"
8384
#include "TooSmallLoopVariableCheck.h"
@@ -229,6 +230,8 @@ class BugproneModule : public ClangTidyModule {
229230
"bugprone-suspicious-stringview-data-usage");
230231
CheckFactories.registerCheck<SwappedArgumentsCheck>(
231232
"bugprone-swapped-arguments");
233+
CheckFactories.registerCheck<TaggedUnionMemberCountCheck>(
234+
"bugprone-tagged-union-member-count");
232235
CheckFactories.registerCheck<TerminatingContinueCheck>(
233236
"bugprone-terminating-continue");
234237
CheckFactories.registerCheck<ThrowKeywordMissingCheck>(

clang-tools-extra/clang-tidy/bugprone/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ add_clang_library(clangTidyBugproneModule
7373
SuspiciousSemicolonCheck.cpp
7474
SuspiciousStringCompareCheck.cpp
7575
SwappedArgumentsCheck.cpp
76+
TaggedUnionMemberCountCheck.cpp
7677
TerminatingContinueCheck.cpp
7778
ThrowKeywordMissingCheck.cpp
7879
TooSmallLoopVariableCheck.cpp

0 commit comments

Comments
 (0)