Skip to content

Commit 1629cad

Browse files
committed
merge main into amd-staging
2 parents aba7cd1 + 90beda2 commit 1629cad

File tree

175 files changed

+5828
-1781
lines changed

Some content is hidden

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

175 files changed

+5828
-1781
lines changed

.ci/monolithic-linux.sh

Lines changed: 10 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -102,51 +102,25 @@ if [[ "${runtimes}" != "" ]]; then
102102
exit 1
103103
fi
104104

105-
echo "--- ninja install-clang"
106-
107-
ninja -C ${BUILD_DIR} install-clang install-clang-resource-headers
108-
109-
RUNTIMES_BUILD_DIR="${MONOREPO_ROOT}/build-runtimes"
110-
INSTALL_DIR="${BUILD_DIR}/install"
111-
mkdir -p ${RUNTIMES_BUILD_DIR}
112-
113105
echo "--- cmake runtimes C++26"
114106

115-
rm -rf "${RUNTIMES_BUILD_DIR}"
116-
cmake -S "${MONOREPO_ROOT}/runtimes" -B "${RUNTIMES_BUILD_DIR}" -GNinja \
117-
-D CMAKE_C_COMPILER="${INSTALL_DIR}/bin/clang" \
118-
-D CMAKE_CXX_COMPILER="${INSTALL_DIR}/bin/clang++" \
119-
-D LLVM_ENABLE_RUNTIMES="${runtimes}" \
120-
-D LIBCXX_CXX_ABI=libcxxabi \
121-
-D CMAKE_BUILD_TYPE=RelWithDebInfo \
122-
-D CMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \
123-
-D LIBCXX_TEST_PARAMS="std=c++26" \
124-
-D LIBCXXABI_TEST_PARAMS="std=c++26" \
125-
-D LLVM_LIT_ARGS="${lit_args}"
107+
cmake \
108+
-D LIBCXX_TEST_PARAMS="std=c++26" \
109+
-D LIBCXXABI_TEST_PARAMS="std=c++26" \
110+
"${BUILD_DIR}"
126111

127112
echo "--- ninja runtimes C++26"
128113

129-
ninja -vC "${RUNTIMES_BUILD_DIR}" ${runtime_targets}
114+
ninja -C "${BUILD_DIR}" ${runtime_targets}
130115

131116
echo "--- cmake runtimes clang modules"
132117

133-
# We don't need to do a clean build of runtimes, because LIBCXX_TEST_PARAMS
134-
# and LIBCXXABI_TEST_PARAMS only affect lit configuration, which successfully
135-
# propagates without a clean build. Other that those two variables, builds
136-
# are supposed to be the same.
137-
138-
cmake -S "${MONOREPO_ROOT}/runtimes" -B "${RUNTIMES_BUILD_DIR}" -GNinja \
139-
-D CMAKE_C_COMPILER="${INSTALL_DIR}/bin/clang" \
140-
-D CMAKE_CXX_COMPILER="${INSTALL_DIR}/bin/clang++" \
141-
-D LLVM_ENABLE_RUNTIMES="${runtimes}" \
142-
-D LIBCXX_CXX_ABI=libcxxabi \
143-
-D CMAKE_BUILD_TYPE=RelWithDebInfo \
144-
-D CMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \
145-
-D LIBCXX_TEST_PARAMS="enable_modules=clang" \
146-
-D LIBCXXABI_TEST_PARAMS="enable_modules=clang" \
147-
-D LLVM_LIT_ARGS="${lit_args}"
118+
cmake \
119+
-D LIBCXX_TEST_PARAMS="enable_modules=clang" \
120+
-D LIBCXXABI_TEST_PARAMS="enable_modules=clang" \
121+
"${BUILD_DIR}"
148122

149123
echo "--- ninja runtimes clang modules"
150124

151-
ninja -vC "${RUNTIMES_BUILD_DIR}" ${runtime_targets}
125+
ninja -C "${BUILD_DIR}" ${runtime_targets}
152126
fi

bolt/include/bolt/Profile/DataAggregator.h

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,13 @@ class DataAggregator : public DataReader {
7878
static bool checkPerfDataMagic(StringRef FileName);
7979

8080
private:
81+
struct LBREntry {
82+
uint64_t From;
83+
uint64_t To;
84+
bool Mispred;
85+
};
86+
friend raw_ostream &operator<<(raw_ostream &OS, const LBREntry &);
87+
8188
struct PerfBranchSample {
8289
SmallVector<LBREntry, 32> LBR;
8390
};
@@ -476,7 +483,6 @@ class DataAggregator : public DataReader {
476483

477484
/// Debugging dump methods
478485
void dump() const;
479-
void dump(const LBREntry &LBR) const;
480486
void dump(const PerfBranchSample &Sample) const;
481487
void dump(const PerfMemSample &Sample) const;
482488

@@ -504,6 +510,12 @@ class DataAggregator : public DataReader {
504510

505511
friend class YAMLProfileWriter;
506512
};
513+
514+
inline raw_ostream &operator<<(raw_ostream &OS,
515+
const DataAggregator::LBREntry &L) {
516+
OS << formatv("{0:x} -> {1:x}/{2}", L.From, L.To, L.Mispred ? 'M' : 'P');
517+
return OS;
518+
}
507519
} // namespace bolt
508520
} // namespace llvm
509521

bolt/include/bolt/Profile/DataReader.h

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,6 @@ namespace bolt {
3232

3333
class BinaryFunction;
3434

35-
struct LBREntry {
36-
uint64_t From;
37-
uint64_t To;
38-
bool Mispred;
39-
};
40-
41-
inline raw_ostream &operator<<(raw_ostream &OS, const LBREntry &LBR) {
42-
OS << "0x" << Twine::utohexstr(LBR.From) << " -> 0x"
43-
<< Twine::utohexstr(LBR.To);
44-
return OS;
45-
}
46-
4735
struct Location {
4836
bool IsSymbol;
4937
StringRef Name;

bolt/lib/Profile/DataAggregator.cpp

Lines changed: 13 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -580,8 +580,10 @@ void DataAggregator::processProfile(BinaryContext &BC) {
580580
}
581581
}
582582

583-
for (auto &FuncBranches : NamesToBranches)
583+
for (auto &FuncBranches : NamesToBranches) {
584584
llvm::stable_sort(FuncBranches.second.Data);
585+
llvm::stable_sort(FuncBranches.second.EntryData);
586+
}
585587

586588
for (auto &MemEvents : NamesToMemEvents)
587589
llvm::stable_sort(MemEvents.second.Data);
@@ -733,8 +735,10 @@ bool DataAggregator::doBranch(uint64_t From, uint64_t To, uint64_t Count,
733735
// corresponds to a return (if \p IsFrom) or a call continuation (otherwise).
734736
auto handleAddress = [&](uint64_t &Addr, bool IsFrom) {
735737
BinaryFunction *Func = getBinaryFunctionContainingAddress(Addr);
736-
if (!Func)
738+
if (!Func) {
739+
Addr = 0;
737740
return std::pair{Func, false};
741+
}
738742

739743
Addr -= Func->getAddress();
740744

@@ -972,7 +976,7 @@ bool DataAggregator::recordExit(BinaryFunction &BF, uint64_t From, bool Mispred,
972976
return true;
973977
}
974978

975-
ErrorOr<LBREntry> DataAggregator::parseLBREntry() {
979+
ErrorOr<DataAggregator::LBREntry> DataAggregator::parseLBREntry() {
976980
LBREntry Res;
977981
ErrorOr<StringRef> FromStrRes = parseString('/');
978982
if (std::error_code EC = FromStrRes.getError())
@@ -1430,54 +1434,16 @@ void DataAggregator::parseLBRSample(const PerfBranchSample &Sample,
14301434
const uint64_t TraceTo = NextLBR->From;
14311435
const BinaryFunction *TraceBF =
14321436
getBinaryFunctionContainingAddress(TraceFrom);
1433-
if (opts::HeatmapMode == opts::HeatmapModeKind::HM_Exclusive) {
1434-
FTInfo &Info = FallthroughLBRs[Trace(TraceFrom, TraceTo)];
1437+
FTInfo &Info = FallthroughLBRs[Trace(TraceFrom, TraceTo)];
1438+
if (TraceBF && TraceBF->containsAddress(LBR.From))
14351439
++Info.InternCount;
1436-
} else if (TraceBF && TraceBF->containsAddress(TraceTo)) {
1437-
FTInfo &Info = FallthroughLBRs[Trace(TraceFrom, TraceTo)];
1438-
if (TraceBF->containsAddress(LBR.From))
1439-
++Info.InternCount;
1440-
else
1441-
++Info.ExternCount;
1442-
} else {
1443-
const BinaryFunction *ToFunc =
1444-
getBinaryFunctionContainingAddress(TraceTo);
1445-
if (TraceBF && ToFunc) {
1446-
LLVM_DEBUG({
1447-
dbgs() << "Invalid trace starting in " << TraceBF->getPrintName()
1448-
<< formatv(" @ {0:x}", TraceFrom - TraceBF->getAddress())
1449-
<< formatv(" and ending @ {0:x}\n", TraceTo);
1450-
});
1451-
++NumInvalidTraces;
1452-
} else {
1453-
LLVM_DEBUG({
1454-
dbgs() << "Out of range trace starting in "
1455-
<< (TraceBF ? TraceBF->getPrintName() : "None")
1456-
<< formatv(" @ {0:x}",
1457-
TraceFrom - (TraceBF ? TraceBF->getAddress() : 0))
1458-
<< " and ending in "
1459-
<< (ToFunc ? ToFunc->getPrintName() : "None")
1460-
<< formatv(" @ {0:x}\n",
1461-
TraceTo - (ToFunc ? ToFunc->getAddress() : 0));
1462-
});
1463-
++NumLongRangeTraces;
1464-
}
1465-
}
1440+
else
1441+
++Info.ExternCount;
14661442
++NumTraces;
14671443
}
14681444
NextLBR = &LBR;
14691445

1470-
// Record branches outside binary functions for heatmap.
1471-
if (opts::HeatmapMode == opts::HeatmapModeKind::HM_Exclusive) {
1472-
TakenBranchInfo &Info = BranchLBRs[Trace(LBR.From, LBR.To)];
1473-
++Info.TakenCount;
1474-
continue;
1475-
}
1476-
uint64_t From = getBinaryFunctionContainingAddress(LBR.From) ? LBR.From : 0;
1477-
uint64_t To = getBinaryFunctionContainingAddress(LBR.To) ? LBR.To : 0;
1478-
if (!From && !To)
1479-
continue;
1480-
TakenBranchInfo &Info = BranchLBRs[Trace(From, To)];
1446+
TakenBranchInfo &Info = BranchLBRs[Trace(LBR.From, LBR.To)];
14811447
++Info.TakenCount;
14821448
Info.MispredCount += LBR.Mispred;
14831449
}
@@ -2398,16 +2364,10 @@ std::error_code DataAggregator::writeBATYAML(BinaryContext &BC,
23982364

23992365
void DataAggregator::dump() const { DataReader::dump(); }
24002366

2401-
void DataAggregator::dump(const LBREntry &LBR) const {
2402-
Diag << "From: " << Twine::utohexstr(LBR.From)
2403-
<< " To: " << Twine::utohexstr(LBR.To) << " Mispred? " << LBR.Mispred
2404-
<< "\n";
2405-
}
2406-
24072367
void DataAggregator::dump(const PerfBranchSample &Sample) const {
24082368
Diag << "Sample LBR entries: " << Sample.LBR.size() << "\n";
24092369
for (const LBREntry &LBR : Sample.LBR)
2410-
dump(LBR);
2370+
Diag << LBR << '\n';
24112371
}
24122372

24132373
void DataAggregator::dump(const PerfMemSample &Sample) const {

bolt/test/X86/pre-aggregated-perf.test

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -36,26 +36,26 @@ RUN: llvm-bolt %t.exe -p %p/Inputs/pre-aggregated.txt --pa -o %t.null | FileChec
3636

3737
CHECK: BOLT-INFO: 4 out of 7 functions in the binary (57.1%) have non-empty execution profile
3838

39-
RUN: cat %t | sort | FileCheck %s -check-prefix=PERF2BOLT
40-
RUN: cat %t.new | FileCheck %s -check-prefix=NEWFORMAT
39+
RUN: FileCheck %s -check-prefix=PERF2BOLT --input-file %t
40+
RUN: FileCheck %s -check-prefix=NEWFORMAT --input-file %t.new
4141

4242
## Test --profile-format option with perf2bolt
4343
RUN: perf2bolt %t.exe -o %t.fdata --pa -p %p/Inputs/pre-aggregated.txt \
4444
RUN: --profile-format=fdata
45-
RUN: cat %t.fdata | sort | FileCheck %s -check-prefix=PERF2BOLT
45+
RUN: FileCheck %s -check-prefix=PERF2BOLT --input-file %t.fdata
4646

4747
RUN: perf2bolt %t.exe -o %t.yaml --pa -p %p/Inputs/pre-aggregated.txt \
4848
RUN: --profile-format=yaml --profile-use-dfs
49-
RUN: cat %t.yaml | FileCheck %s -check-prefix=NEWFORMAT
49+
RUN: FileCheck %s -check-prefix=NEWFORMAT --input-file %t.yaml
5050

5151
## Test --profile-format option with llvm-bolt --aggregate-only
5252
RUN: llvm-bolt %t.exe -o %t.bolt.fdata --pa -p %p/Inputs/pre-aggregated.txt \
5353
RUN: --aggregate-only --profile-format=fdata
54-
RUN: cat %t.bolt.fdata | sort | FileCheck %s -check-prefix=PERF2BOLT
54+
RUN: FileCheck %s -check-prefix=PERF2BOLT --input-file %t.bolt.fdata
5555

5656
RUN: llvm-bolt %t.exe -o %t.bolt.yaml --pa -p %p/Inputs/pre-aggregated.txt \
5757
RUN: --aggregate-only --profile-format=yaml --profile-use-dfs
58-
RUN: cat %t.bolt.yaml | FileCheck %s -check-prefix=NEWFORMAT
58+
RUN: FileCheck %s -check-prefix=NEWFORMAT --input-file %t.bolt.yaml
5959

6060
## Test pre-aggregated basic profile
6161
RUN: perf2bolt %t.exe -o %t --pa -p %p/Inputs/pre-aggregated-basic.txt -o %t.ba \
@@ -67,16 +67,17 @@ BASIC-ERROR: BOLT-INFO: 0 out of 7 functions in the binary (0.0%) have non-empty
6767
BASIC-SUCCESS: BOLT-INFO: 4 out of 7 functions in the binary (57.1%) have non-empty execution profile
6868
CHECK-BASIC-NL: no_lbr cycles
6969

70-
PERF2BOLT: 0 [unknown] 7f36d18d60c0 1 main 53c 0 2
71-
PERF2BOLT: 1 main 451 1 SolveCubic 0 0 2
72-
PERF2BOLT: 1 main 490 0 [unknown] 4005f0 0 1
73-
PERF2BOLT: 1 main 537 0 [unknown] 400610 0 1
74-
PERF2BOLT: 1 usqrt 30 1 usqrt 32 0 22
75-
PERF2BOLT: 1 usqrt 30 1 usqrt 39 4 33
76-
PERF2BOLT: 1 usqrt 35 1 usqrt 39 0 22
77-
PERF2BOLT: 1 usqrt 3d 1 usqrt 10 0 58
78-
PERF2BOLT: 1 usqrt 3d 1 usqrt 3f 0 22
79-
PERF2BOLT: 1 usqrt a 1 usqrt 10 0 22
70+
PERF2BOLT: 1 frame_dummy/1 1e 1 frame_dummy/1 0 0 1
71+
PERF2BOLT-NEXT: 1 main 451 1 SolveCubic 0 0 2
72+
PERF2BOLT-NEXT: 1 main 490 0 [unknown] 0 0 1
73+
PERF2BOLT-NEXT: 1 main 537 0 [unknown] 0 0 1
74+
PERF2BOLT-NEXT: 0 [unknown] 0 1 main 53c 0 2
75+
PERF2BOLT-NEXT: 1 usqrt a 1 usqrt 10 0 22
76+
PERF2BOLT-NEXT: 1 usqrt 30 1 usqrt 32 0 22
77+
PERF2BOLT-NEXT: 1 usqrt 30 1 usqrt 39 4 33
78+
PERF2BOLT-NEXT: 1 usqrt 35 1 usqrt 39 0 22
79+
PERF2BOLT-NEXT: 1 usqrt 3d 1 usqrt 10 0 58
80+
PERF2BOLT-NEXT: 1 usqrt 3d 1 usqrt 3f 0 22
8081

8182
NEWFORMAT: - name: 'frame_dummy/1'
8283
NEWFORMAT: fid: 3

clang-tools-extra/clang-tidy/abseil/AbseilTidyModule.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,12 @@ class AbseilModule : public ClangTidyModule {
5959
CheckFactories.registerCheck<NoNamespaceCheck>("abseil-no-namespace");
6060
CheckFactories.registerCheck<RedundantStrcatCallsCheck>(
6161
"abseil-redundant-strcat-calls");
62-
CheckFactories.registerCheck<StrCatAppendCheck>(
63-
"abseil-str-cat-append");
62+
CheckFactories.registerCheck<StrCatAppendCheck>("abseil-str-cat-append");
6463
CheckFactories.registerCheck<StringFindStartswithCheck>(
6564
"abseil-string-find-startswith");
6665
CheckFactories.registerCheck<StringFindStrContainsCheck>(
6766
"abseil-string-find-str-contains");
68-
CheckFactories.registerCheck<TimeComparisonCheck>(
69-
"abseil-time-comparison");
67+
CheckFactories.registerCheck<TimeComparisonCheck>("abseil-time-comparison");
7068
CheckFactories.registerCheck<TimeSubtractionCheck>(
7169
"abseil-time-subtraction");
7270
CheckFactories.registerCheck<UpgradeDurationConversionsCheck>(

clang-tools-extra/clang-tidy/abseil/DurationDivisionCheck.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ namespace clang::tidy::abseil {
1515

1616
// Find potential incorrect uses of integer division of absl::Duration objects.
1717
//
18-
// For the user-facing documentation see:
18+
// For the user-facing documentation see:
1919
// http://clang.llvm.org/extra/clang-tidy/checks/abseil/duration-division.html
2020

2121
class DurationDivisionCheck : public ClangTidyCheck {

clang-tools-extra/clang-tidy/abseil/NoInternalDependenciesCheck.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ void NoInternalDependenciesCheck::registerMatchers(MatchFinder *Finder) {
2727
this);
2828
}
2929

30-
void NoInternalDependenciesCheck::check(const MatchFinder::MatchResult &Result) {
30+
void NoInternalDependenciesCheck::check(
31+
const MatchFinder::MatchResult &Result) {
3132
const auto *InternalDependency =
3233
Result.Nodes.getNodeAs<NestedNameSpecifierLoc>("InternalDep");
3334

clang-tools-extra/clang-tidy/abseil/NoInternalDependenciesCheck.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//===--- NoInternalDependenciesCheck.h - clang-tidy----------------------*- C++ -*-===//
1+
//===--- NoInternalDependenciesCheck.h - clang-tidy--------------*- C++ -*-===//
22
//
33
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
44
// See https://llvm.org/LICENSE.txt for license information.

clang-tools-extra/clang-tidy/abseil/NoNamespaceCheck.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,9 @@ using namespace clang::ast_matchers;
1515
namespace clang::tidy::abseil {
1616

1717
void NoNamespaceCheck::registerMatchers(MatchFinder *Finder) {
18-
Finder->addMatcher(
19-
namespaceDecl(hasName("::absl"), unless(isInAbseilFile()))
20-
.bind("abslNamespace"),
21-
this);
18+
Finder->addMatcher(namespaceDecl(hasName("::absl"), unless(isInAbseilFile()))
19+
.bind("abslNamespace"),
20+
this);
2221
}
2322

2423
void NoNamespaceCheck::check(const MatchFinder::MatchResult &Result) {

0 commit comments

Comments
 (0)