Skip to content

Commit 4c5d08b

Browse files
authored
Merge branch 'main' into hgh/libcxx/P2164R9-ranges-enumerate_view
2 parents 9c20572 + 48deb35 commit 4c5d08b

File tree

1,651 files changed

+56914
-42679
lines changed

Some content is hidden

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

1,651 files changed

+56914
-42679
lines changed

.ci/generate-buildkite-pipeline-premerge

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,9 @@ 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
@@ -216,7 +219,7 @@ 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)
222225
# Currently there is no testing for libclc.

.github/new-prs-labeler.yml

Lines changed: 1 addition & 1 deletion
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/release-binaries.yml

Lines changed: 1 addition & 1 deletion
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 \

bolt/include/bolt/Profile/BoltAddressTranslation.h

Lines changed: 6 additions & 5 deletions
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/lib/Core/BinaryFunction.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3684,9 +3684,8 @@ BinaryFunction::BasicBlockListType BinaryFunction::dfs() const {
36843684
BinaryBasicBlock *BB = Stack.top();
36853685
Stack.pop();
36863686

3687-
if (Visited.find(BB) != Visited.end())
3687+
if (!Visited.insert(BB).second)
36883688
continue;
3689-
Visited.insert(BB);
36903689
DFS.push_back(BB);
36913690

36923691
for (BinaryBasicBlock *SuccBB : BB->landing_pads()) {
@@ -3879,11 +3878,8 @@ void BinaryFunction::disambiguateJumpTables(
38793878
JumpTable *JT = getJumpTable(Inst);
38803879
if (!JT)
38813880
continue;
3882-
auto Iter = JumpTables.find(JT);
3883-
if (Iter == JumpTables.end()) {
3884-
JumpTables.insert(JT);
3881+
if (JumpTables.insert(JT).second)
38853882
continue;
3886-
}
38873883
// This instruction is an indirect jump using a jump table, but it is
38883884
// using the same jump table of another jump. Try all our tricks to
38893885
// extract the jump table symbol and make it point to a new, duplicated JT

bolt/lib/Core/DIEBuilder.cpp

Lines changed: 3 additions & 5 deletions
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;

bolt/lib/Profile/BoltAddressTranslation.cpp

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,8 @@ void BoltAddressTranslation::write(const BinaryContext &BC, raw_ostream &OS) {
143143

144144
// Output addresses are delta-encoded
145145
uint64_t PrevAddress = 0;
146-
writeMaps</*Cold=*/false>(Maps, PrevAddress, OS);
147-
writeMaps</*Cold=*/true>(Maps, PrevAddress, OS);
146+
writeMaps</*Cold=*/false>(PrevAddress, OS);
147+
writeMaps</*Cold=*/true>(PrevAddress, OS);
148148

149149
BC.outs() << "BOLT-INFO: Wrote " << Maps.size() << " BAT maps\n";
150150
BC.outs() << "BOLT-INFO: Wrote " << FuncHashes.getNumFunctions()
@@ -182,8 +182,7 @@ size_t BoltAddressTranslation::getNumEqualOffsets(const MapTy &Map,
182182
}
183183

184184
template <bool Cold>
185-
void BoltAddressTranslation::writeMaps(std::map<uint64_t, MapTy> &Maps,
186-
uint64_t &PrevAddress, raw_ostream &OS) {
185+
void BoltAddressTranslation::writeMaps(uint64_t &PrevAddress, raw_ostream &OS) {
187186
const uint32_t NumFuncs =
188187
llvm::count_if(llvm::make_first_range(Maps), [&](const uint64_t Address) {
189188
return Cold == ColdPartSource.count(Address);
@@ -213,16 +212,17 @@ void BoltAddressTranslation::writeMaps(std::map<uint64_t, MapTy> &Maps,
213212
: 0;
214213
uint32_t Skew = 0;
215214
if (Cold) {
216-
auto HotEntryIt = Maps.find(ColdPartSource[Address]);
217-
assert(HotEntryIt != Maps.end());
218-
size_t HotIndex = std::distance(Maps.begin(), HotEntryIt);
215+
auto HotEntryIt = llvm::lower_bound(HotFuncs, ColdPartSource[Address]);
216+
assert(HotEntryIt != HotFuncs.end());
217+
size_t HotIndex = std::distance(HotFuncs.begin(), HotEntryIt);
219218
encodeULEB128(HotIndex - PrevIndex, OS);
220219
PrevIndex = HotIndex;
221220
// Skew of all input offsets for cold fragments is simply the first input
222221
// offset.
223222
Skew = Map.begin()->second >> 1;
224223
encodeULEB128(Skew, OS);
225224
} else {
225+
HotFuncs.push_back(Address);
226226
// Function hash
227227
size_t BFHash = getBFHash(HotInputAddress);
228228
LLVM_DEBUG(dbgs() << "Hash: " << formatv("{0:x}\n", BFHash));
@@ -311,17 +311,15 @@ std::error_code BoltAddressTranslation::parse(raw_ostream &OS, StringRef Buf) {
311311
return make_error_code(llvm::errc::io_error);
312312

313313
Error Err(Error::success());
314-
std::vector<uint64_t> HotFuncs;
315314
uint64_t PrevAddress = 0;
316-
parseMaps</*Cold=*/false>(HotFuncs, PrevAddress, DE, Offset, Err);
317-
parseMaps</*Cold=*/true>(HotFuncs, PrevAddress, DE, Offset, Err);
315+
parseMaps</*Cold=*/false>(PrevAddress, DE, Offset, Err);
316+
parseMaps</*Cold=*/true>(PrevAddress, DE, Offset, Err);
318317
OS << "BOLT-INFO: Parsed " << Maps.size() << " BAT entries\n";
319318
return errorToErrorCode(std::move(Err));
320319
}
321320

322321
template <bool Cold>
323-
void BoltAddressTranslation::parseMaps(std::vector<uint64_t> &HotFuncs,
324-
uint64_t &PrevAddress, DataExtractor &DE,
322+
void BoltAddressTranslation::parseMaps(uint64_t &PrevAddress, DataExtractor &DE,
325323
uint64_t &Offset, Error &Err) {
326324
const uint32_t NumFunctions = DE.getULEB128(&Offset, &Err);
327325
LLVM_DEBUG(dbgs() << "Parsing " << NumFunctions << (Cold ? " cold" : "")

bolt/lib/Profile/YAMLProfileReader.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -643,11 +643,7 @@ size_t YAMLProfileReader::matchWithNameSimilarity(BinaryContext &BC) {
643643
// equal number of blocks.
644644
if (NamespaceToProfiledBFSizesIt->second.count(BF->size()) == 0)
645645
continue;
646-
auto NamespaceToBFsIt = NamespaceToBFs.find(Namespace);
647-
if (NamespaceToBFsIt == NamespaceToBFs.end())
648-
NamespaceToBFs[Namespace] = {BF};
649-
else
650-
NamespaceToBFsIt->second.push_back(BF);
646+
NamespaceToBFs[Namespace].push_back(BF);
651647
}
652648

653649
// Iterates through all profiled functions and binary functions belonging to

clang-tools-extra/clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -148,11 +148,8 @@ groupReplacements(const TUReplacements &TUs, const TUDiagnostics &TUDs,
148148

149149
if (auto Entry = SM.getFileManager().getOptionalFileRef(Path)) {
150150
if (SourceTU) {
151-
auto &Replaces = DiagReplacements[*Entry];
152-
auto It = Replaces.find(R);
153-
if (It == Replaces.end())
154-
Replaces.emplace(R, SourceTU);
155-
else if (It->second != SourceTU)
151+
auto [It, Inserted] = DiagReplacements[*Entry].try_emplace(R, SourceTU);
152+
if (!Inserted && It->second != SourceTU)
156153
// This replacement is a duplicate of one suggested by another TU.
157154
return;
158155
}

clang-tools-extra/clang-change-namespace/ChangeNamespace.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -606,9 +606,8 @@ void ChangeNamespaceTool::run(
606606
Result.Nodes.getNodeAs<DeclRefExpr>("func_ref")) {
607607
// If this reference has been processed as a function call, we do not
608608
// process it again.
609-
if (ProcessedFuncRefs.count(FuncRef))
609+
if (!ProcessedFuncRefs.insert(FuncRef).second)
610610
return;
611-
ProcessedFuncRefs.insert(FuncRef);
612611
const auto *Func = Result.Nodes.getNodeAs<FunctionDecl>("func_decl");
613612
assert(Func);
614613
const auto *Context = Result.Nodes.getNodeAs<Decl>("dc");

0 commit comments

Comments
 (0)