Skip to content

Commit d9610da

Browse files
author
Jenkins
committed
merge main into amd-stg-open
Change-Id: I643746a9d6ced03a8e7582e1c8eedac5f09ec9dc
2 parents afb522c + 12c6625 commit d9610da

File tree

97 files changed

+850
-738
lines changed

Some content is hidden

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

97 files changed

+850
-738
lines changed

bolt/utils/nfc-stat-parser.py

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
#!/usr/bin/env python3
2+
import argparse
3+
import csv
4+
import re
5+
import sys
6+
import os
7+
from statistics import geometric_mean
8+
9+
TIMING_LOG_RE = re.compile(r"(.*)/(.*).tmp(.*)")
10+
11+
12+
def main():
13+
parser = argparse.ArgumentParser(
14+
description="BOLT NFC stat parser",
15+
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
16+
)
17+
parser.add_argument(
18+
"input", nargs="+", help="timing.log files produced by llvm-bolt-wrapper"
19+
)
20+
parser.add_argument(
21+
"--check_longer_than",
22+
default=0.5,
23+
type=float,
24+
help="Only warn on tests longer than X seconds for at least one side",
25+
)
26+
parser.add_argument(
27+
"--threshold_single",
28+
default=10,
29+
type=float,
30+
help="Threshold for a single test result swing, abs percent",
31+
),
32+
parser.add_argument(
33+
"--threshold_agg",
34+
default=5,
35+
type=float,
36+
help="Threshold for geomean test results swing, abs percent",
37+
),
38+
parser.add_argument("--verbose", "-v", action="store_true")
39+
args = parser.parse_args()
40+
41+
def fmt_delta(value, exc_threshold, above_bound=True):
42+
formatted_value = format(value, "+.2%")
43+
if not above_bound:
44+
formatted_value += "?"
45+
elif exc_threshold and sys.stdout.isatty(): # terminal supports colors
46+
return f"\033[1m{formatted_value}\033[0m"
47+
return formatted_value
48+
49+
# Ratios for geomean computation
50+
time_ratios = []
51+
mem_ratios = []
52+
# Whether any test exceeds the single test threshold (mem or time)
53+
threshold_single = False
54+
# Whether geomean exceeds aggregate test threshold (mem or time)
55+
threshold_agg = False
56+
57+
if args.verbose:
58+
print(f"# Individual test threshold: +-{args.threshold_single}%")
59+
print(f"# Aggregate (geomean) test threshold: +-{args.threshold_agg}%")
60+
print(
61+
f"# Checking time swings for tests with runtime >"
62+
f"{args.check_longer_than}s - otherwise marked as ?"
63+
)
64+
print("Test/binary BOLT_wall_time BOLT_max_rss")
65+
66+
for input_file in args.input:
67+
input_dir = os.path.dirname(input_file)
68+
with open(input_file) as timing_file:
69+
timing_reader = csv.reader(timing_file, delimiter=";")
70+
for row in timing_reader:
71+
test_name = row[0]
72+
m = TIMING_LOG_RE.match(row[0])
73+
if m:
74+
test_name = f"{input_dir}/{m.groups()[1]}/{m.groups()[2]}"
75+
else:
76+
# Prepend input dir to unparsed test name
77+
test_name = input_dir + "#" + test_name
78+
time_a, time_b = float(row[1]), float(row[3])
79+
mem_a, mem_b = int(row[2]), int(row[4])
80+
# Check if time is above bound for at least one side
81+
time_above_bound = any(
82+
[x > args.check_longer_than for x in [time_a, time_b]]
83+
)
84+
# Compute B/A ratios (for % delta and geomean)
85+
time_ratio = time_b / time_a if time_a else float('nan')
86+
mem_ratio = mem_b / mem_a if mem_a else float('nan')
87+
# Keep ratios for geomean
88+
if time_above_bound and time_ratio > 0: # must be >0 for gmean
89+
time_ratios += [time_ratio]
90+
mem_ratios += [mem_ratio]
91+
# Deltas: (B/A)-1 = (B-A)/A
92+
time_delta = time_ratio - 1
93+
mem_delta = mem_ratio - 1
94+
# Check individual test results vs single test threshold
95+
time_exc = (
96+
100.0 * abs(time_delta) > args.threshold_single and time_above_bound
97+
)
98+
mem_exc = 100.0 * abs(mem_delta) > args.threshold_single
99+
if time_exc or mem_exc:
100+
threshold_single = True
101+
# Print deltas with formatting in verbose mode
102+
if args.verbose or time_exc or mem_exc:
103+
print(
104+
test_name,
105+
fmt_delta(time_delta, time_exc, time_above_bound),
106+
fmt_delta(mem_delta, mem_exc),
107+
)
108+
109+
time_gmean_delta = geometric_mean(time_ratios) - 1
110+
mem_gmean_delta = geometric_mean(mem_ratios) - 1
111+
time_agg_threshold = 100.0 * abs(time_gmean_delta) > args.threshold_agg
112+
mem_agg_threshold = 100.0 * abs(mem_gmean_delta) > args.threshold_agg
113+
if time_agg_threshold or mem_agg_threshold:
114+
threshold_agg = True
115+
if time_agg_threshold or mem_agg_threshold or args.verbose:
116+
print(
117+
"Geomean",
118+
fmt_delta(time_gmean_delta, time_agg_threshold),
119+
fmt_delta(mem_gmean_delta, mem_agg_threshold),
120+
)
121+
exit(threshold_single or threshold_agg)
122+
123+
124+
if __name__ == "__main__":
125+
main()

clang/include/clang/StaticAnalyzer/Core/PathSensitive/DynamicType.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
#include "clang/StaticAnalyzer/Core/PathSensitive/ProgramStateTrait.h"
2323
#include "clang/StaticAnalyzer/Core/PathSensitive/ProgramState_Fwd.h"
2424
#include "clang/StaticAnalyzer/Core/PathSensitive/SymbolManager.h"
25-
#include "llvm/ADT/ImmutableMap.h"
2625

2726
namespace clang {
2827
namespace ento {

clang/lib/CodeGen/CGCall.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1395,7 +1395,7 @@ static void CreateCoercedStore(llvm::Value *Src,
13951395
llvm::PointerType *DstPtrTy = llvm::dyn_cast<llvm::PointerType>(DstTy);
13961396
if (SrcPtrTy && DstPtrTy &&
13971397
SrcPtrTy->getAddressSpace() != DstPtrTy->getAddressSpace()) {
1398-
Src = CGF.Builder.CreatePointerBitCastOrAddrSpaceCast(Src, DstTy);
1398+
Src = CGF.Builder.CreateAddrSpaceCast(Src, DstTy);
13991399
CGF.Builder.CreateStore(Src, Dst, DstIsVolatile);
14001400
return;
14011401
}

clang/lib/CodeGen/CodeGenFunction.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1121,11 +1121,9 @@ void CodeGenFunction::StartFunction(GlobalDecl GD, QualType RetTy,
11211121
Address(&*AI, ConvertType(RetTy),
11221122
CurFnInfo->getReturnInfo().getIndirectAlign(), KnownNonNull);
11231123
if (!CurFnInfo->getReturnInfo().getIndirectByVal()) {
1124-
ReturnValuePointer =
1125-
CreateDefaultAlignTempAlloca(Int8PtrTy, "result.ptr");
1126-
Builder.CreateStore(Builder.CreatePointerBitCastOrAddrSpaceCast(
1127-
ReturnValue.getPointer(), Int8PtrTy),
1128-
ReturnValuePointer);
1124+
ReturnValuePointer = CreateDefaultAlignTempAlloca(
1125+
ReturnValue.getPointer()->getType(), "result.ptr");
1126+
Builder.CreateStore(ReturnValue.getPointer(), ReturnValuePointer);
11291127
}
11301128
} else if (CurFnInfo->getReturnInfo().getKind() == ABIArgInfo::InAlloca &&
11311129
!hasScalarEvaluationKind(CurFnInfo->getReturnType())) {

clang/lib/CodeGen/ItaniumCXXABI.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3087,9 +3087,6 @@ void ItaniumCXXABI::EmitThreadLocalInitFuncs(
30873087
CharUnits Align = CGM.getContext().getDeclAlign(VD);
30883088
Val = Builder.CreateAlignedLoad(Var->getValueType(), Val, Align);
30893089
}
3090-
if (Val->getType() != Wrapper->getReturnType())
3091-
Val = Builder.CreatePointerBitCastOrAddrSpaceCast(
3092-
Val, Wrapper->getReturnType(), "");
30933090

30943091
Builder.CreateRet(Val);
30953092
}

clang/lib/CodeGen/TargetInfo.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ llvm::Value *TargetCodeGenInfo::performAddrSpaceCast(
137137
if (auto *C = dyn_cast<llvm::Constant>(Src))
138138
return performAddrSpaceCast(CGF.CGM, C, SrcAddr, DestAddr, DestTy);
139139
// Try to preserve the source's name to make IR more readable.
140-
return CGF.Builder.CreatePointerBitCastOrAddrSpaceCast(
140+
return CGF.Builder.CreateAddrSpaceCast(
141141
Src, DestTy, Src->hasName() ? Src->getName() + ".ascast" : "");
142142
}
143143

clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountChecker.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
#include "llvm/ADT/DenseMap.h"
3737
#include "llvm/ADT/FoldingSet.h"
3838
#include "llvm/ADT/ImmutableList.h"
39-
#include "llvm/ADT/ImmutableMap.h"
4039
#include "llvm/ADT/STLExtras.h"
4140
#include "llvm/ADT/SmallString.h"
4241
#include "llvm/ADT/StringExtras.h"

clang/www/cxx_status.html

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,23 @@ <h2 id="cxx26">C++2c implementation status</h2>
147147
<td><a href="https://wg21.link/P2169R4">P2169R4</a></td>
148148
<td class="unreleased" align="center">Clang 18</td>
149149
</tr>
150+
<!-- Fall 2023 papers (Kona) -->
151+
<tr>
152+
<td>Template parameter initialization</td>
153+
<td><a href="https://wg21.link/P2308R1">P2308R1</a> (<a href="#dr">DR</a>)</td>
154+
<td class="none" align="center">No</td>
155+
</tr>
156+
<tr>
157+
<td>Pack Indexing</td>
158+
<td><a href="https://wg21.link/P2662R3">P2662R3</a></td>
159+
<td class="none" align="center">No</td>
160+
</tr>
161+
<tr>
162+
<td>Remove Deprecated Arithmetic Conversion on Enumerations</td>
163+
<td><a href="https://wg21.link/P2864R2">P2864R2</a></td>
164+
<td class="none" align="center">No</td>
165+
</tr>
166+
150167
</table>
151168
</details>
152169

libcxx/include/__algorithm/ranges_equal_range.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//===----------------------------------------------------------------------===//
22
//
3-
// Part of the LLVM __project, under the Apache License v2.0 with LLVM Exceptions.
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
44
// See https://llvm.org/LICENSE.txt for license information.
55
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
66
//

lldb/include/lldb/Target/MemoryRegionInfo.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,11 @@ class MemoryRegionInfo {
8181
// lldb::Permissions
8282
uint32_t GetLLDBPermissions() const {
8383
uint32_t permissions = 0;
84-
if (m_read)
84+
if (m_read == eYes)
8585
permissions |= lldb::ePermissionsReadable;
86-
if (m_write)
86+
if (m_write == eYes)
8787
permissions |= lldb::ePermissionsWritable;
88-
if (m_execute)
88+
if (m_execute == eYes)
8989
permissions |= lldb::ePermissionsExecutable;
9090
return permissions;
9191
}
@@ -151,7 +151,7 @@ class MemoryRegionInfo {
151151
int m_pagesize = 0;
152152
std::optional<std::vector<lldb::addr_t>> m_dirty_pages;
153153
};
154-
154+
155155
inline bool operator<(const MemoryRegionInfo &lhs,
156156
const MemoryRegionInfo &rhs) {
157157
return lhs.GetRange() < rhs.GetRange();

lldb/include/lldb/Target/Process.h

Lines changed: 37 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
#include "lldb/Utility/UserIDResolver.h"
5555
#include "lldb/lldb-private.h"
5656

57+
#include "llvm/ADT/AddressRanges.h"
5758
#include "llvm/ADT/ArrayRef.h"
5859
#include "llvm/Support/Threading.h"
5960
#include "llvm/Support/VersionTuple.h"
@@ -354,12 +355,10 @@ class Process : public std::enable_shared_from_this<Process>,
354355
};
355356
// This is all the event bits the public process broadcaster broadcasts.
356357
// The process shadow listener signs up for all these bits...
357-
static constexpr int g_all_event_bits = eBroadcastBitStateChanged
358-
| eBroadcastBitInterrupt
359-
| eBroadcastBitSTDOUT
360-
| eBroadcastBitSTDERR
361-
| eBroadcastBitProfileData
362-
| eBroadcastBitStructuredData;
358+
static constexpr int g_all_event_bits =
359+
eBroadcastBitStateChanged | eBroadcastBitInterrupt | eBroadcastBitSTDOUT |
360+
eBroadcastBitSTDERR | eBroadcastBitProfileData |
361+
eBroadcastBitStructuredData;
363362

364363
enum {
365364
eBroadcastInternalStateControlStop = (1 << 0),
@@ -390,7 +389,7 @@ class Process : public std::enable_shared_from_this<Process>,
390389
ConstString &GetBroadcasterClass() const override {
391390
return GetStaticBroadcasterClass();
392391
}
393-
392+
394393
/// A notification structure that can be used by clients to listen
395394
/// for changes in a process's lifetime.
396395
///
@@ -579,7 +578,7 @@ class Process : public std::enable_shared_from_this<Process>,
579578
/// of CommandObject like CommandObjectRaw, CommandObjectParsed,
580579
/// or CommandObjectMultiword.
581580
virtual CommandObject *GetPluginCommandObject() { return nullptr; }
582-
581+
583582
/// The underlying plugin might store the low-level communication history for
584583
/// this session. Dump it into the provided stream.
585584
virtual void DumpPluginHistory(Stream &s) { return; }
@@ -614,7 +613,7 @@ class Process : public std::enable_shared_from_this<Process>,
614613
return error;
615614
}
616615

617-
/// The "ShadowListener" for a process is just an ordinary Listener that
616+
/// The "ShadowListener" for a process is just an ordinary Listener that
618617
/// listens for all the Process event bits. It's convenient because you can
619618
/// specify it in the LaunchInfo or AttachInfo, so it will get events from
620619
/// the very start of the process.
@@ -704,6 +703,35 @@ class Process : public std::enable_shared_from_this<Process>,
704703
/// is not supported by the plugin, error otherwise.
705704
virtual llvm::Expected<bool> SaveCore(llvm::StringRef outfile);
706705

706+
struct CoreFileMemoryRange {
707+
llvm::AddressRange range; /// The address range to save into the core file.
708+
uint32_t lldb_permissions; /// A bit set of lldb::Permissions bits.
709+
710+
bool operator==(const CoreFileMemoryRange &rhs) const {
711+
return range == rhs.range && lldb_permissions == rhs.lldb_permissions;
712+
}
713+
714+
bool operator!=(const CoreFileMemoryRange &rhs) const {
715+
return !(*this == rhs);
716+
}
717+
718+
bool operator<(const CoreFileMemoryRange &rhs) const {
719+
if (range < rhs.range)
720+
return true;
721+
if (range == rhs.range)
722+
return lldb_permissions < rhs.lldb_permissions;
723+
return false;
724+
}
725+
};
726+
727+
using CoreFileMemoryRanges = std::vector<CoreFileMemoryRange>;
728+
729+
/// Helper function for Process::SaveCore(...) that calculates the address
730+
/// ranges that should be saved. This allows all core file plug-ins to save
731+
/// consistent memory ranges given a \a core_style.
732+
Status CalculateCoreFileSaveRanges(lldb::SaveCoreStyle core_style,
733+
CoreFileMemoryRanges &ranges);
734+
707735
protected:
708736
virtual JITLoaderList &GetJITLoaders();
709737

0 commit comments

Comments
 (0)