Skip to content

Commit c2e1653

Browse files
authored
Merge branch 'main' into users/kparzysz/spr/a04-atomic-one
2 parents 4546997 + 9732427 commit c2e1653

File tree

474 files changed

+14011
-4561
lines changed

Some content is hidden

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

474 files changed

+14011
-4561
lines changed

bolt/include/bolt/Profile/DataAggregator.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -197,10 +197,6 @@ class DataAggregator : public DataReader {
197197

198198
BoltAddressTranslation *BAT{nullptr};
199199

200-
/// Whether pre-aggregated profile needs to convert branch profile into call
201-
/// to continuation fallthrough profile.
202-
bool NeedsConvertRetProfileToCallCont{false};
203-
204200
/// Update function execution profile with a recorded trace.
205201
/// A trace is region of code executed between two LBR entries supplied in
206202
/// execution order.

bolt/lib/Profile/DataAggregator.cpp

Lines changed: 7 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -720,23 +720,6 @@ bool DataAggregator::doBranch(uint64_t From, uint64_t To, uint64_t Count,
720720
: isReturn(Func.disassembleInstructionAtOffset(Offset));
721721
};
722722

723-
// Returns whether \p Offset in \p Func may be a call continuation excluding
724-
// entry points and landing pads.
725-
auto checkCallCont = [&](const BinaryFunction &Func, const uint64_t Offset) {
726-
// No call continuation at a function start.
727-
if (!Offset)
728-
return false;
729-
730-
// FIXME: support BAT case where the function might be in empty state
731-
// (split fragments declared non-simple).
732-
if (!Func.hasCFG())
733-
return false;
734-
735-
// The offset should not be an entry point or a landing pad.
736-
const BinaryBasicBlock *ContBB = Func.getBasicBlockAtOffset(Offset);
737-
return ContBB && !ContBB->isEntryPoint() && !ContBB->isLandingPad();
738-
};
739-
740723
// Mutates \p Addr to an offset into the containing function, performing BAT
741724
// offset translation and parent lookup.
742725
//
@@ -749,8 +732,7 @@ bool DataAggregator::doBranch(uint64_t From, uint64_t To, uint64_t Count,
749732

750733
Addr -= Func->getAddress();
751734

752-
bool IsRetOrCallCont =
753-
IsFrom ? checkReturn(*Func, Addr) : checkCallCont(*Func, Addr);
735+
bool IsRet = IsFrom && checkReturn(*Func, Addr);
754736

755737
if (BAT)
756738
Addr = BAT->translate(Func->getAddress(), Addr, IsFrom);
@@ -761,24 +743,16 @@ bool DataAggregator::doBranch(uint64_t From, uint64_t To, uint64_t Count,
761743
NumColdSamples += Count;
762744

763745
if (!ParentFunc)
764-
return std::pair{Func, IsRetOrCallCont};
746+
return std::pair{Func, IsRet};
765747

766-
return std::pair{ParentFunc, IsRetOrCallCont};
748+
return std::pair{ParentFunc, IsRet};
767749
};
768750

769-
uint64_t ToOrig = To;
770751
auto [FromFunc, IsReturn] = handleAddress(From, /*IsFrom*/ true);
771-
auto [ToFunc, IsCallCont] = handleAddress(To, /*IsFrom*/ false);
752+
auto [ToFunc, _] = handleAddress(To, /*IsFrom*/ false);
772753
if (!FromFunc && !ToFunc)
773754
return false;
774755

775-
// Record call to continuation trace.
776-
if (NeedsConvertRetProfileToCallCont && FromFunc != ToFunc &&
777-
(IsReturn || IsCallCont)) {
778-
LBREntry First{ToOrig - 1, ToOrig - 1, false};
779-
LBREntry Second{ToOrig, ToOrig, false};
780-
return doTrace(First, Second, Count);
781-
}
782756
// Ignore returns.
783757
if (IsReturn)
784758
return true;
@@ -1235,21 +1209,14 @@ std::error_code DataAggregator::parseAggregatedLBREntry() {
12351209
ErrorOr<StringRef> TypeOrErr = parseString(FieldSeparator);
12361210
if (std::error_code EC = TypeOrErr.getError())
12371211
return EC;
1238-
// Pre-aggregated profile with branches and fallthroughs needs to convert
1239-
// return profile into call to continuation fall-through.
1240-
auto Type = AggregatedLBREntry::BRANCH;
1241-
if (TypeOrErr.get() == "B") {
1242-
NeedsConvertRetProfileToCallCont = true;
1212+
auto Type = AggregatedLBREntry::TRACE;
1213+
if (LLVM_LIKELY(TypeOrErr.get() == "T")) {
1214+
} else if (TypeOrErr.get() == "B") {
12431215
Type = AggregatedLBREntry::BRANCH;
12441216
} else if (TypeOrErr.get() == "F") {
1245-
NeedsConvertRetProfileToCallCont = true;
12461217
Type = AggregatedLBREntry::FT;
12471218
} else if (TypeOrErr.get() == "f") {
1248-
NeedsConvertRetProfileToCallCont = true;
12491219
Type = AggregatedLBREntry::FT_EXTERNAL_ORIGIN;
1250-
} else if (TypeOrErr.get() == "T") {
1251-
// Trace is expanded into B and [Ff]
1252-
Type = AggregatedLBREntry::TRACE;
12531220
} else {
12541221
reportError("expected T, B, F or f");
12551222
return make_error_code(llvm::errc::io_error);

bolt/test/X86/callcont-fallthru.s

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,31 +4,12 @@
44
# RUN: %clang %cflags -fpic -shared -xc /dev/null -o %t.so
55
## Link against a DSO to ensure PLT entries.
66
# RUN: %clangxx %cxxflags %s %t.so -o %t -Wl,-q -nostdlib
7-
# RUN: link_fdata %s %t %t.pa1 PREAGG1
8-
# RUN: link_fdata %s %t %t.pa2 PREAGG2
9-
# RUN: link_fdata %s %t %t.pa3 PREAGG3
107
# RUN: link_fdata %s %t %t.pat PREAGGT1
118
# RUN: link_fdata %s %t %t.pat2 PREAGGT2
129
# RUN: link_fdata %s %t %t.patplt PREAGGPLT
1310

14-
## Check normal case: fallthrough is not LP or secondary entry.
1511
# RUN: llvm-strip --strip-unneeded %t -o %t.strip
1612
# RUN: llvm-objcopy --remove-section=.eh_frame %t.strip %t.noeh
17-
# RUN: llvm-bolt %t.strip --pa -p %t.pa1 -o %t.out \
18-
# RUN: --print-cfg --print-only=main | FileCheck %s
19-
20-
## Check that getFallthroughsInTrace correctly handles a trace starting at plt
21-
## call continuation
22-
# RUN: llvm-bolt %t.strip --pa -p %t.pa2 -o %t.out2 \
23-
# RUN: --print-cfg --print-only=main | FileCheck %s --check-prefix=CHECK2
24-
25-
## Check that we don't treat secondary entry points as call continuation sites.
26-
# RUN: llvm-bolt %t --pa -p %t.pa3 -o %t.out \
27-
# RUN: --print-cfg --print-only=main | FileCheck %s --check-prefix=CHECK3
28-
29-
## Check fallthrough to a landing pad case.
30-
# RUN: llvm-bolt %t.strip --pa -p %t.pa3 -o %t.out \
31-
# RUN: --print-cfg --print-only=main | FileCheck %s --check-prefix=CHECK3
3213

3314
## Check pre-aggregated traces attach call continuation fallthrough count
3415
# RUN: llvm-bolt %t.noeh --pa -p %t.pat -o %t.out \
@@ -77,7 +58,6 @@ Ltmp0_br:
7758
## Check PLT traces are accepted
7859
# PREAGGPLT: T #Ltmp0_br# #puts@plt# #puts@plt# 3
7960
## Target is an external-origin call continuation
80-
# PREAGG1: B X:0 #Ltmp1# 2 0
8161
# PREAGGT1: T X:0 #Ltmp1# #Ltmp4_br# 2
8262
# CHECK: callq puts@PLT
8363
# CHECK-NEXT: count: 2
@@ -97,18 +77,15 @@ Ltmp4_br:
9777
movl $0xa, -0x18(%rbp)
9878
callq foo
9979
## Target is a binary-local call continuation
100-
# PREAGG1: B #Lfoo_ret# #Ltmp3# 1 0
10180
# PREAGGT1: T #Lfoo_ret# #Ltmp3# #Ltmp3_br# 1
10281
# CHECK: callq foo
10382
# CHECK-NEXT: count: 1
10483

10584
## PLT call continuation fallthrough spanning the call
106-
# PREAGG2: F #Ltmp1# #Ltmp3_br# 3
10785
# CHECK2: callq foo
10886
# CHECK2-NEXT: count: 3
10987

11088
## Target is a secondary entry point (unstripped) or a landing pad (stripped)
111-
# PREAGG3: B X:0 #Ltmp3# 2 0
11289
# PREAGGT2: T X:0 #Ltmp3# #Ltmp3_br# 2
11390
# CHECK3: callq foo
11491
# CHECK3-NEXT: count: 0

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ static SourceLocation getStartOfNextLine(SourceLocation Loc,
113113
const SourceManager &SM,
114114
const LangOptions &LangOpts) {
115115
std::unique_ptr<Lexer> Lex = getLexerStartingFromLoc(Loc, SM, LangOpts);
116-
if (!Lex.get())
116+
if (!Lex)
117117
return SourceLocation();
118118
llvm::SmallVector<char, 16> Line;
119119
// FIXME: this is a bit hacky to get ReadToEndOfLine work.
@@ -647,9 +647,8 @@ static SourceLocation getLocAfterNamespaceLBrace(const NamespaceDecl *NsDecl,
647647
const LangOptions &LangOpts) {
648648
std::unique_ptr<Lexer> Lex =
649649
getLexerStartingFromLoc(NsDecl->getBeginLoc(), SM, LangOpts);
650-
assert(Lex.get() &&
651-
"Failed to create lexer from the beginning of namespace.");
652-
if (!Lex.get())
650+
assert(Lex && "Failed to create lexer from the beginning of namespace.");
651+
if (!Lex)
653652
return SourceLocation();
654653
Token Tok;
655654
while (!Lex->LexFromRawLexer(Tok) && Tok.isNot(tok::TokenKind::l_brace)) {

clang-tools-extra/clang-doc/Representation.h

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,13 @@ struct TypedefInfo : public SymbolInfo {
415415

416416
TypeInfo Underlying;
417417

418-
// Inidicates if this is a new C++ "using"-style typedef:
418+
// Underlying type declaration
419+
SmallString<16> TypeDeclaration;
420+
421+
/// Comment description for the typedef.
422+
std::vector<CommentInfo> Description;
423+
424+
// Indicates if this is a new C++ "using"-style typedef:
419425
// using MyVector = std::vector<int>
420426
// False means it's a C-style typedef:
421427
// typedef std::vector<int> MyVector;
@@ -458,7 +464,8 @@ struct EnumValueInfo {
458464
// constant. This will be empty for implicit enumeration values.
459465
SmallString<16> ValueExpr;
460466

461-
std::vector<CommentInfo> Description; /// Comment description of this field.
467+
/// Comment description of this field.
468+
std::vector<CommentInfo> Description;
462469
};
463470

464471
// TODO: Expand to allow for documenting templating.

0 commit comments

Comments
 (0)