Skip to content

Commit 4f8d61f

Browse files
committed
Merge remote-tracking branch 'upstream/main' into libcxx/bind_front_nttp
2 parents 328e808 + 4678f16 commit 4f8d61f

File tree

1,507 files changed

+268761
-9588
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,507 files changed

+268761
-9588
lines changed

.github/workflows/release-binaries.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -132,11 +132,6 @@ jobs:
132132
arches=arm64
133133
else
134134
arches=x86_64
135-
# Disable Flang builds on macOS x86_64. The FortranLower library takes
136-
# 2-3 hours to build on macOS, much slower than on Linux.
137-
# The long build time causes the release build to time out on x86_64,
138-
# so we need to disable flang there.
139-
target_cmake_flags="$target_cmake_flags -DLLVM_RELEASE_ENABLE_PROJECTS='clang;lld;lldb;clang-tools-extra;polly;mlir'"
140135
fi
141136
target_cmake_flags="$target_cmake_flags -DBOOTSTRAP_BOOTSTRAP_DARWIN_osx_ARCHS=$arches -DBOOTSTRAP_BOOTSTRAP_DARWIN_osx_BUILTIN_ARCHS=$arches"
142137
fi

bolt/include/bolt/Core/BinaryFunction.h

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -620,13 +620,11 @@ class BinaryFunction {
620620
}
621621

622622
/// Return a label at a given \p Address in the function. If the label does
623-
/// not exist - create it. Assert if the \p Address does not belong to
624-
/// the function. If \p CreatePastEnd is true, then return the function
625-
/// end label when the \p Address points immediately past the last byte
626-
/// of the function.
623+
/// not exist - create it.
624+
///
627625
/// NOTE: the function always returns a local (temp) symbol, even if there's
628626
/// a global symbol that corresponds to an entry at this address.
629-
MCSymbol *getOrCreateLocalLabel(uint64_t Address, bool CreatePastEnd = false);
627+
MCSymbol *getOrCreateLocalLabel(uint64_t Address);
630628

631629
/// Register an data entry at a given \p Offset into the function.
632630
void markDataAtOffset(uint64_t Offset) {

bolt/include/bolt/Passes/MarkRAStates.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,16 @@
1313
#define BOLT_PASSES_MARK_RA_STATES
1414

1515
#include "bolt/Passes/BinaryPasses.h"
16+
#include <mutex>
1617

1718
namespace llvm {
1819
namespace bolt {
1920

2021
class MarkRAStates : public BinaryFunctionPass {
22+
// setIgnored() is not thread-safe, but the pass is running on functions in
23+
// parallel.
24+
std::mutex IgnoreMutex;
25+
2126
public:
2227
explicit MarkRAStates() : BinaryFunctionPass(false) {}
2328

bolt/lib/Core/BinaryFunction.cpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1035,13 +1035,9 @@ BinaryFunction::processIndirectBranch(MCInst &Instruction, unsigned Size,
10351035
return BranchType;
10361036
}
10371037

1038-
MCSymbol *BinaryFunction::getOrCreateLocalLabel(uint64_t Address,
1039-
bool CreatePastEnd) {
1038+
MCSymbol *BinaryFunction::getOrCreateLocalLabel(uint64_t Address) {
10401039
const uint64_t Offset = Address - getAddress();
10411040

1042-
if ((Offset == getSize()) && CreatePastEnd)
1043-
return getFunctionEndLabel();
1044-
10451041
auto LI = Labels.find(Offset);
10461042
if (LI != Labels.end())
10471043
return LI->second;
@@ -1052,6 +1048,9 @@ MCSymbol *BinaryFunction::getOrCreateLocalLabel(uint64_t Address,
10521048
return IslandSym;
10531049
}
10541050

1051+
if (Offset == getSize())
1052+
return getFunctionEndLabel();
1053+
10551054
MCSymbol *Label = BC.Ctx->createNamedTempSymbol();
10561055
Labels[Offset] = Label;
10571056

@@ -1994,7 +1993,7 @@ void BinaryFunction::postProcessJumpTables() {
19941993
if (IsBuiltinUnreachable) {
19951994
BinaryFunction *TargetBF = BC.getBinaryFunctionAtAddress(EntryAddress);
19961995
MCSymbol *Label = TargetBF ? TargetBF->getSymbol()
1997-
: getOrCreateLocalLabel(EntryAddress, true);
1996+
: getOrCreateLocalLabel(EntryAddress);
19981997
JT.Entries.push_back(Label);
19991998
continue;
20001999
}
@@ -2005,7 +2004,7 @@ void BinaryFunction::postProcessJumpTables() {
20052004
BC.getBinaryFunctionContainingAddress(EntryAddress);
20062005
MCSymbol *Label;
20072006
if (HasOneParent && TargetBF == this) {
2008-
Label = getOrCreateLocalLabel(EntryAddress, true);
2007+
Label = getOrCreateLocalLabel(EntryAddress);
20092008
} else {
20102009
const uint64_t Offset = EntryAddress - TargetBF->getAddress();
20112010
Label = Offset ? TargetBF->addEntryPointAtOffset(Offset)

bolt/lib/Passes/BinaryPasses.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,13 +346,16 @@ void EliminateUnreachableBlocks::runOnFunction(BinaryFunction &Function) {
346346
uint64_t Bytes;
347347
Function.markUnreachableBlocks();
348348
LLVM_DEBUG({
349+
bool HasInvalidBB = false;
349350
for (BinaryBasicBlock &BB : Function) {
350351
if (!BB.isValid()) {
352+
HasInvalidBB = true;
351353
dbgs() << "BOLT-INFO: UCE found unreachable block " << BB.getName()
352354
<< " in function " << Function << "\n";
353-
Function.dump();
354355
}
355356
}
357+
if (HasInvalidBB)
358+
Function.dump();
356359
});
357360
BinaryContext::IndependentCodeEmitter Emitter =
358361
BC.createIndependentMCCodeEmitter();

bolt/lib/Passes/MarkRAStates.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,11 @@ bool MarkRAStates::runOnFunction(BinaryFunction &BF) {
4343
// Not all functions have .cfi_negate_ra_state in them. But if one does,
4444
// we expect psign/pauth instructions to have the hasNegateRAState
4545
// annotation.
46-
BF.setIgnored();
4746
BC.outs() << "BOLT-INFO: inconsistent RAStates in function "
4847
<< BF.getPrintName()
4948
<< ": ptr sign/auth inst without .cfi_negate_ra_state\n";
49+
std::lock_guard<std::mutex> Lock(IgnoreMutex);
50+
BF.setIgnored();
5051
return false;
5152
}
5253
}
@@ -67,6 +68,7 @@ bool MarkRAStates::runOnFunction(BinaryFunction &BF) {
6768
BC.outs() << "BOLT-INFO: inconsistent RAStates in function "
6869
<< BF.getPrintName()
6970
<< ": ptr signing inst encountered in Signed RA state\n";
71+
std::lock_guard<std::mutex> Lock(IgnoreMutex);
7072
BF.setIgnored();
7173
return false;
7274
}
@@ -80,6 +82,7 @@ bool MarkRAStates::runOnFunction(BinaryFunction &BF) {
8082
<< BF.getPrintName()
8183
<< ": ptr authenticating inst encountered in Unsigned RA "
8284
"state\n";
85+
std::lock_guard<std::mutex> Lock(IgnoreMutex);
8386
BF.setIgnored();
8487
return false;
8588
}

bolt/lib/Rewrite/RewriteInstance.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2949,9 +2949,7 @@ void RewriteInstance::handleRelocation(const SectionRef &RelocatedSection,
29492949
ReferencedSymbol =
29502950
ReferencedBF->addEntryPointAtOffset(RefFunctionOffset);
29512951
} else {
2952-
ReferencedSymbol =
2953-
ReferencedBF->getOrCreateLocalLabel(Address,
2954-
/*CreatePastEnd =*/true);
2952+
ReferencedSymbol = ReferencedBF->getOrCreateLocalLabel(Address);
29552953

29562954
// If ContainingBF != nullptr, it equals ReferencedBF (see
29572955
// if-condition above) so we're handling a relocation from a function

bolt/test/X86/dwarf4-ftypes-dwp-input-dwo-output.test

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# UNSUPPORTED: system-linux
21
; RUN: rm -rf %t
32
; RUN: mkdir %t
43
; RUN: cd %t

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

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,10 @@ ClangTidyCheck::OptionsView::getLocalOrGlobal(StringRef LocalName) const {
9090
return std::nullopt;
9191
}
9292

93-
static std::optional<bool> getAsBool(StringRef Value,
94-
const llvm::Twine &LookupName) {
95-
93+
static std::optional<bool> getAsBool(StringRef Value) {
9694
if (std::optional<bool> Parsed = llvm::yaml::parseBool(Value))
9795
return Parsed;
98-
// To maintain backwards compatability, we support parsing numbers as
96+
// To maintain backwards compatibility, we support parsing numbers as
9997
// booleans, even though its not supported in YAML.
10098
long long Number = 0;
10199
if (!Value.getAsInteger(10, Number))
@@ -107,7 +105,7 @@ template <>
107105
std::optional<bool>
108106
ClangTidyCheck::OptionsView::get<bool>(StringRef LocalName) const {
109107
if (std::optional<StringRef> ValueOr = get(LocalName)) {
110-
if (auto Result = getAsBool(*ValueOr, NamePrefix + LocalName))
108+
if (auto Result = getAsBool(*ValueOr))
111109
return Result;
112110
diagnoseBadBooleanOption(NamePrefix + LocalName, *ValueOr);
113111
}
@@ -119,7 +117,7 @@ std::optional<bool>
119117
ClangTidyCheck::OptionsView::getLocalOrGlobal<bool>(StringRef LocalName) const {
120118
auto Iter = findPriorityOption(CheckOptions, NamePrefix, LocalName, Context);
121119
if (Iter != CheckOptions.end()) {
122-
if (auto Result = getAsBool(Iter->getValue().Value, Iter->getKey()))
120+
if (auto Result = getAsBool(Iter->getValue().Value))
123121
return Result;
124122
diagnoseBadBooleanOption(Iter->getKey(), Iter->getValue().Value);
125123
}

clang-tools-extra/clang-tidy/ClangTidyModule.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ class ClangTidyCheckFactories {
8585
/// them a prefixed name.
8686
class ClangTidyModule {
8787
public:
88-
virtual ~ClangTidyModule() {}
88+
virtual ~ClangTidyModule() = default;
8989

9090
/// Implement this function in order to register all \c CheckFactories
9191
/// belonging to this module.

0 commit comments

Comments
 (0)