Skip to content

Commit 797177b

Browse files
committed
Merge remote-tracking branch 'upstream/llvmspirv_pulldown' into HEAD
Closes: #16022
2 parents dac260f + 2057848 commit 797177b

File tree

9,073 files changed

+521764
-253551
lines changed

Some content is hidden

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

9,073 files changed

+521764
-253551
lines changed

.ci/generate-buildkite-pipeline-premerge

+6-3
Original file line numberDiff line numberDiff line change
@@ -191,14 +191,17 @@ function keep-modified-projects() {
191191
}
192192

193193
function check-targets() {
194+
# Do not use "check-all" here because if there is "check-all" plus a
195+
# project specific target like "check-clang", that project's tests
196+
# will be run twice.
194197
projects=${@}
195198
for project in ${projects}; do
196199
case ${project} in
197200
clang-tools-extra)
198201
echo "check-clang-tools"
199202
;;
200203
compiler-rt)
201-
echo "check-all"
204+
echo "check-compiler-rt"
202205
;;
203206
cross-project-tests)
204207
echo "check-cross-project"
@@ -216,10 +219,10 @@ function check-targets() {
216219
echo "check-lldb"
217220
;;
218221
pstl)
219-
echo "check-all"
222+
# Currently we do not run pstl tests in CI.
220223
;;
221224
libclc)
222-
echo "check-all"
225+
# Currently there is no testing for libclc.
223226
;;
224227
*)
225228
echo "check-${project}"

.gitattributes

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
.github/CODEOWNERS merge=ours
2+
23
libcxx/src/**/*.cpp merge=libcxx-reformat
34
libcxx/include/**/*.h merge=libcxx-reformat
45

.github/new-prs-labeler.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ PGO:
6969
- llvm/**/llvm-profdata/**/*
7070
- llvm/**/llvm-profgen/**/*
7171

72-
vectorization:
72+
vectorizers:
7373
- llvm/lib/Transforms/Vectorize/**/*
7474
- llvm/include/llvm/Transforms/Vectorize/**/*
7575

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

+15-8
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

+1
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

+9-9
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ jobs:
328328
run: |
329329
# Build some of the mlir tools that take a long time to link
330330
if [ "${{ needs.prepare.outputs.build-flang }}" = "true" ]; then
331-
ninja -C ${{ steps.setup-stage.outputs.build-prefix }}/build/tools/clang/stage2-bins/ -j2 flang-new bbc
331+
ninja -C ${{ steps.setup-stage.outputs.build-prefix }}/build/tools/clang/stage2-bins/ -j2 flang bbc
332332
fi
333333
ninja -C ${{ steps.setup-stage.outputs.build-prefix }}/build/tools/clang/stage2-bins/ \
334334
mlir-bytecode-parser-fuzzer \
@@ -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

+8-5
Original file line numberDiff line numberDiff line change
@@ -73,17 +73,20 @@ jobs:
7373
ref: main
7474
fetch-depth: 0
7575
path: www-releases
76+
persist-credentials: false
7677

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

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ autoconf/autom4te.cache
5555
/CMakeSettings.json
5656
# CLion project configuration
5757
/.idea
58+
/cmake-build*
5859

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

bolt/include/bolt/Core/BinaryBasicBlock.h

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include "bolt/Core/MCPlus.h"
2020
#include "llvm/ADT/GraphTraits.h"
2121
#include "llvm/ADT/StringRef.h"
22+
#include "llvm/Config/llvm-config.h" // for LLVM_ON_UNIX
2223
#include "llvm/MC/MCInst.h"
2324
#include "llvm/MC/MCSymbol.h"
2425
#include "llvm/Support/ErrorOr.h"

bolt/include/bolt/Core/BinaryContext.h

+5-4
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,15 @@ struct SegmentInfo {
7171
uint64_t FileOffset; /// Offset in the file.
7272
uint64_t FileSize; /// Size in file.
7373
uint64_t Alignment; /// Alignment of the segment.
74+
bool IsExecutable; /// Is the executable bit set on the Segment?
7475

7576
void print(raw_ostream &OS) const {
76-
OS << "SegmentInfo { Address: 0x"
77-
<< Twine::utohexstr(Address) << ", Size: 0x"
78-
<< Twine::utohexstr(Size) << ", FileOffset: 0x"
77+
OS << "SegmentInfo { Address: 0x" << Twine::utohexstr(Address)
78+
<< ", Size: 0x" << Twine::utohexstr(Size) << ", FileOffset: 0x"
7979
<< Twine::utohexstr(FileOffset) << ", FileSize: 0x"
8080
<< Twine::utohexstr(FileSize) << ", Alignment: 0x"
81-
<< Twine::utohexstr(Alignment) << "}";
81+
<< Twine::utohexstr(Alignment) << ", " << (IsExecutable ? "x" : " ")
82+
<< "}";
8283
};
8384
};
8485

bolt/include/bolt/Core/BinaryData.h

-1
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

-1
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/include/bolt/Core/DIEBuilder.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ class DIEBuilder {
314314

315315
BC.errs()
316316
<< "BOLT-ERROR: unable to find TypeUnit for Type Unit at offset 0x"
317-
<< DU.getOffset() << "\n";
317+
<< Twine::utohexstr(DU.getOffset()) << "\n";
318318
return nullptr;
319319
}
320320

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
//===- bolt/Passes/ContinuityStats.h ----------------------------*- C++ -*-===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
//
9+
// This pass checks how well the BOLT input profile satisfies the following
10+
// "CFG continuity" property of a perfect profile:
11+
//
12+
// Each positive-execution-count block in the function’s CFG
13+
// should be *reachable* from a positive-execution-count function
14+
// entry block through a positive-execution-count path.
15+
//
16+
// More specifically, for each of the hottest 1000 functions, the pass
17+
// calculates the function’s fraction of basic block execution counts
18+
// that is *unreachable*. It then reports the 95th percentile of the
19+
// distribution of the 1000 unreachable fractions in a single BOLT-INFO line.
20+
// The smaller the reported value is, the better the BOLT profile
21+
// satisfies the CFG continuity property.
22+
23+
// The default value of 1000 above can be changed via the hidden BOLT option
24+
// `-num-functions-for-continuity-check=[N]`.
25+
// If more detailed stats are needed, `-v=1` can be used: the hottest N
26+
// functions will be grouped into 5 equally-sized buckets, from the hottest
27+
// to the coldest; for each bucket, various summary statistics of the
28+
// distribution of the unreachable fractions and the raw unreachable execution
29+
// counts will be reported.
30+
//
31+
//===----------------------------------------------------------------------===//
32+
33+
#ifndef BOLT_PASSES_CONTINUITYSTATS_H
34+
#define BOLT_PASSES_CONTINUITYSTATS_H
35+
36+
#include "bolt/Passes/BinaryPasses.h"
37+
#include <vector>
38+
39+
namespace llvm {
40+
41+
class raw_ostream;
42+
43+
namespace bolt {
44+
class BinaryContext;
45+
46+
/// Compute and report to the user the function CFG continuity quality
47+
class PrintContinuityStats : public BinaryFunctionPass {
48+
public:
49+
explicit PrintContinuityStats(const cl::opt<bool> &PrintPass)
50+
: BinaryFunctionPass(PrintPass) {}
51+
52+
bool shouldOptimize(const BinaryFunction &BF) const override;
53+
const char *getName() const override { return "continuity-stats"; }
54+
bool shouldPrint(const BinaryFunction &) const override { return false; }
55+
Error runOnFunctions(BinaryContext &BC) override;
56+
};
57+
58+
} // namespace bolt
59+
} // namespace llvm
60+
61+
#endif // BOLT_PASSES_CONTINUITYSTATS_H

bolt/include/bolt/Profile/BoltAddressTranslation.h

+6-5
Original file line numberDiff line numberDiff line change
@@ -141,15 +141,13 @@ class BoltAddressTranslation {
141141
uint64_t FuncOutputAddress) const;
142142

143143
/// Write the serialized address translation table for a function.
144-
template <bool Cold>
145-
void writeMaps(std::map<uint64_t, MapTy> &Maps, uint64_t &PrevAddress,
146-
raw_ostream &OS);
144+
template <bool Cold> void writeMaps(uint64_t &PrevAddress, raw_ostream &OS);
147145

148146
/// Read the serialized address translation table for a function.
149147
/// Return a parse error if failed.
150148
template <bool Cold>
151-
void parseMaps(std::vector<uint64_t> &HotFuncs, uint64_t &PrevAddress,
152-
DataExtractor &DE, uint64_t &Offset, Error &Err);
149+
void parseMaps(uint64_t &PrevAddress, DataExtractor &DE, uint64_t &Offset,
150+
Error &Err);
153151

154152
/// Returns the bitmask with set bits corresponding to indices of BRANCHENTRY
155153
/// entries in function address translation map.
@@ -161,6 +159,9 @@ class BoltAddressTranslation {
161159

162160
std::map<uint64_t, MapTy> Maps;
163161

162+
/// Ordered vector with addresses of hot functions.
163+
std::vector<uint64_t> HotFuncs;
164+
164165
/// Map a function to its basic blocks count
165166
std::unordered_map<uint64_t, size_t> NumBasicBlocksMap;
166167

bolt/include/bolt/Rewrite/RewriteInstance.h

+5-6
Original file line numberDiff line numberDiff line change
@@ -510,12 +510,11 @@ class RewriteInstance {
510510
};
511511

512512
/// Different types of X86-64 PLT sections.
513-
const PLTSectionInfo X86_64_PLTSections[4] = {
514-
{ ".plt", 16 },
515-
{ ".plt.got", 8 },
516-
{ ".plt.sec", 8 },
517-
{ nullptr, 0 }
518-
};
513+
const PLTSectionInfo X86_64_PLTSections[5] = {{".plt", 16},
514+
{".plt.got", 8},
515+
{".plt.sec", 8},
516+
{".iplt", 16},
517+
{nullptr, 0}};
519518

520519
/// AArch64 PLT sections.
521520
const PLTSectionInfo AArch64_PLTSections[4] = {

bolt/lib/Core/BinaryContext.cpp

+5-2
Original file line numberDiff line numberDiff line change
@@ -1294,8 +1294,8 @@ bool BinaryContext::handleAArch64Veneer(uint64_t Address, bool MatchOnly) {
12941294
Veneer->getOrCreateLocalLabel(Address);
12951295
Veneer->setMaxSize(TotalSize);
12961296
Veneer->updateState(BinaryFunction::State::Disassembled);
1297-
LLVM_DEBUG(dbgs() << "BOLT-DEBUG: handling veneer function at 0x" << Address
1298-
<< "\n");
1297+
LLVM_DEBUG(dbgs() << "BOLT-DEBUG: handling veneer function at 0x"
1298+
<< Twine::utohexstr(Address) << "\n");
12991299
return true;
13001300
};
13011301

@@ -2021,6 +2021,9 @@ BinaryContext::getBaseAddressForMapping(uint64_t MMapAddress,
20212021
// Find a segment with a matching file offset.
20222022
for (auto &KV : SegmentMapInfo) {
20232023
const SegmentInfo &SegInfo = KV.second;
2024+
// Only consider executable segments.
2025+
if (!SegInfo.IsExecutable)
2026+
continue;
20242027
// FileOffset is got from perf event,
20252028
// and it is equal to alignDown(SegInfo.FileOffset, pagesize).
20262029
// If the pagesize is not equal to SegInfo.Alignment.

bolt/lib/Core/BinaryFunction.cpp

+8-6
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

@@ -3678,9 +3684,8 @@ BinaryFunction::BasicBlockListType BinaryFunction::dfs() const {
36783684
BinaryBasicBlock *BB = Stack.top();
36793685
Stack.pop();
36803686

3681-
if (Visited.find(BB) != Visited.end())
3687+
if (!Visited.insert(BB).second)
36823688
continue;
3683-
Visited.insert(BB);
36843689
DFS.push_back(BB);
36853690

36863691
for (BinaryBasicBlock *SuccBB : BB->landing_pads()) {
@@ -3873,11 +3878,8 @@ void BinaryFunction::disambiguateJumpTables(
38733878
JumpTable *JT = getJumpTable(Inst);
38743879
if (!JT)
38753880
continue;
3876-
auto Iter = JumpTables.find(JT);
3877-
if (Iter == JumpTables.end()) {
3878-
JumpTables.insert(JT);
3881+
if (JumpTables.insert(JT).second)
38793882
continue;
3880-
}
38813883
// This instruction is an indirect jump using a jump table, but it is
38823884
// using the same jump table of another jump. Try all our tricks to
38833885
// extract the jump table symbol and make it point to a new, duplicated JT

bolt/lib/Core/DIEBuilder.cpp

+3-5
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,9 @@ getDWOName(llvm::DWARFUnit &CU,
5757
"DW_AT_dwo_name/DW_AT_GNU_dwo_name does not exist.");
5858
if (DwarfOutputPath) {
5959
DWOName = std::string(sys::path::filename(DWOName));
60-
auto Iter = NameToIndexMap.find(DWOName);
61-
if (Iter == NameToIndexMap.end())
62-
Iter = NameToIndexMap.insert({DWOName, 0}).first;
63-
DWOName.append(std::to_string(Iter->second));
64-
++Iter->second;
60+
uint32_t &Index = NameToIndexMap[DWOName];
61+
DWOName.append(std::to_string(Index));
62+
++Index;
6563
}
6664
DWOName.append(".dwo");
6765
return DWOName;

0 commit comments

Comments
 (0)