Skip to content

Commit bcedb28

Browse files
author
Jenkins
committed
merge main into amd-staging
Change-Id: I8a09cbe1d388240e186f21801115bf51c4770b72
2 parents 48a801e + 4206d06 commit bcedb28

File tree

29 files changed

+201
-94
lines changed

29 files changed

+201
-94
lines changed

bolt/lib/Rewrite/DWARFRewriter.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -720,12 +720,7 @@ void DWARFRewriter::updateDebugInfo() {
720720
TempRangesSectionWriter = RangeListsWritersByCU[*DWOId].get();
721721
} else {
722722
RangesBase = RangesSectionWriter->getSectionOffset();
723-
// For DWARF5 there is now .debug_rnglists.dwo, so don't need to
724-
// update rnglists base.
725-
if (RangesBase) {
726-
DwoRangesBase[*DWOId] = *RangesBase;
727-
setDwoRangesBase(*DWOId, *RangesBase);
728-
}
723+
setDwoRangesBase(*DWOId, *RangesBase);
729724
}
730725

731726
updateUnitDebugInfo(*(*SplitCU), DWODIEBuilder, DebugLocDWoWriter,

lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -97,24 +97,28 @@ struct InitializePythonRAII {
9797
InitializePythonRAII() {
9898
InitializePythonHome();
9999

100+
// The table of built-in modules can only be extended before Python is
101+
// initialized.
102+
if (!Py_IsInitialized()) {
100103
#ifdef LLDB_USE_LIBEDIT_READLINE_COMPAT_MODULE
101-
// Python's readline is incompatible with libedit being linked into lldb.
102-
// Provide a patched version local to the embedded interpreter.
103-
bool ReadlinePatched = false;
104-
for (auto *p = PyImport_Inittab; p->name != nullptr; p++) {
105-
if (strcmp(p->name, "readline") == 0) {
106-
p->initfunc = initlldb_readline;
107-
break;
104+
// Python's readline is incompatible with libedit being linked into lldb.
105+
// Provide a patched version local to the embedded interpreter.
106+
bool ReadlinePatched = false;
107+
for (auto *p = PyImport_Inittab; p->name != nullptr; p++) {
108+
if (strcmp(p->name, "readline") == 0) {
109+
p->initfunc = initlldb_readline;
110+
break;
111+
}
112+
}
113+
if (!ReadlinePatched) {
114+
PyImport_AppendInittab("readline", initlldb_readline);
115+
ReadlinePatched = true;
108116
}
109-
}
110-
if (!ReadlinePatched) {
111-
PyImport_AppendInittab("readline", initlldb_readline);
112-
ReadlinePatched = true;
113-
}
114117
#endif
115118

116-
// Register _lldb as a built-in module.
117-
PyImport_AppendInittab("_lldb", LLDBSwigPyInit);
119+
// Register _lldb as a built-in module.
120+
PyImport_AppendInittab("_lldb", LLDBSwigPyInit);
121+
}
118122

119123
// Python < 3.2 and Python >= 3.2 reversed the ordering requirements for
120124
// calling `Py_Initialize` and `PyEval_InitThreads`. < 3.2 requires that you

llvm/include/llvm/Support/Error.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
#include "llvm/Support/ErrorHandling.h"
2323
#include "llvm/Support/ErrorOr.h"
2424
#include "llvm/Support/Format.h"
25-
#include "llvm/Support/FormatVariadic.h"
2625
#include "llvm/Support/raw_ostream.h"
2726
#include <cassert>
2827
#include <cstdint>
@@ -1262,15 +1261,6 @@ inline Error createStringError(std::errc EC, char const *Fmt,
12621261
return createStringError(std::make_error_code(EC), Fmt, Vals...);
12631262
}
12641263

1265-
template <typename... Ts>
1266-
inline Error createStringErrorV(std::error_code EC, const char *Fmt,
1267-
const Ts &...Vals) {
1268-
std::string Buffer;
1269-
raw_string_ostream Stream(Buffer);
1270-
Stream << formatv(Fmt, Vals...);
1271-
return make_error<StringError>(Stream.str(), EC);
1272-
}
1273-
12741264
/// This class wraps a filename and another Error.
12751265
///
12761266
/// In some cases, an error needs to live along a 'source' name, in order to

llvm/include/llvm/TargetParser/Triple.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,14 @@ class Triple {
451451
/// @name Convenience Predicates
452452
/// @{
453453

454+
/// Returns the pointer width of this architecture.
455+
static unsigned getArchPointerBitWidth(llvm::Triple::ArchType Arch);
456+
457+
/// Returns the pointer width of this architecture.
458+
unsigned getArchPointerBitWidth() const {
459+
return getArchPointerBitWidth(getArch());
460+
}
461+
454462
/// Test whether the architecture is 64-bit
455463
///
456464
/// Note that this tests for 64-bit pointer width, and nothing else. Note

llvm/lib/TargetParser/Triple.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1458,7 +1458,7 @@ void Triple::setOSAndEnvironmentName(StringRef Str) {
14581458
setTriple(getArchName() + "-" + getVendorName() + "-" + Str);
14591459
}
14601460

1461-
static unsigned getArchPointerBitWidth(llvm::Triple::ArchType Arch) {
1461+
unsigned Triple::getArchPointerBitWidth(llvm::Triple::ArchType Arch) {
14621462
switch (Arch) {
14631463
case llvm::Triple::UnknownArch:
14641464
return 0;

llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -309,10 +309,10 @@ class SubProcessFunctionExecutorImpl
309309
}
310310

311311
if (ParentOrChildPID == 0) {
312-
// We are in the child process, close the write end of the pipe
312+
// We are in the child process, close the write end of the pipe.
313313
close(PipeFiles[1]);
314314
// Unregister handlers, signal handling is now handled through ptrace in
315-
// the host process
315+
// the host process.
316316
sys::unregisterHandlers();
317317
prepareAndRunBenchmark(PipeFiles[0], Key);
318318
// The child process terminates in the above function, so we should never
@@ -371,7 +371,7 @@ class SubProcessFunctionExecutorImpl
371371
int ChildExitCode = WEXITSTATUS(ChildStatus);
372372
if (ChildExitCode == 0) {
373373
// The child exited succesfully, read counter values and return
374-
// success
374+
// success.
375375
auto CounterValueOrErr = Counter->readOrError();
376376
if (!CounterValueOrErr)
377377
return CounterValueOrErr.takeError();
@@ -387,7 +387,7 @@ class SubProcessFunctionExecutorImpl
387387

388388
return Error::success();
389389
}
390-
// The child exited, but not successfully
390+
// The child exited, but not successfully.
391391
return make_error<Failure>(
392392
"Child benchmarking process exited with non-zero exit code: " +
393393
childProcessExitCodeToString(ChildExitCode));
@@ -423,7 +423,7 @@ class SubProcessFunctionExecutorImpl
423423
// user inspect a core dump.
424424
disableCoreDumps();
425425

426-
// The following occurs within the benchmarking subprocess
426+
// The following occurs within the benchmarking subprocess.
427427
pid_t ParentPID = getppid();
428428

429429
Expected<int> CounterFileDescriptorOrError =
@@ -436,7 +436,7 @@ class SubProcessFunctionExecutorImpl
436436

437437
// Glibc versions greater than 2.35 automatically call rseq during
438438
// initialization. Unmapping the region that glibc sets up for this causes
439-
// segfaults in the program Unregister the rseq region so that we can safely
439+
// segfaults in the program. Unregister the rseq region so that we can safely
440440
// unmap it later
441441
#ifdef GLIBC_INITS_RSEQ
442442
long RseqDisableOutput =
@@ -559,7 +559,7 @@ BenchmarkRunner::getRunnableConfiguration(
559559
}
560560

561561
// Assemble enough repetitions of the snippet so we have at least
562-
// MinInstructios instructions.
562+
// MinInstructions instructions.
563563
if (BenchmarkPhaseSelector >
564564
BenchmarkPhaseSelectorE::PrepareAndAssembleSnippet) {
565565
auto Snippet =
@@ -636,9 +636,10 @@ std::pair<Error, Benchmark> BenchmarkRunner::runConfiguration(
636636
}
637637
assert(BenchmarkResult.MinInstructions > 0 && "invalid MinInstructions");
638638
for (BenchmarkMeasure &BM : *NewMeasurements) {
639-
// Scale the measurements by instruction.
639+
// Scale the measurements by the number of instructions.
640640
BM.PerInstructionValue /= BenchmarkResult.MinInstructions;
641-
// Scale the measurements by snippet.
641+
// Scale the measurements by the number of times the entire snippet is
642+
// repeated.
642643
BM.PerSnippetValue /=
643644
std::ceil(BenchmarkResult.MinInstructions /
644645
static_cast<double>(BenchmarkResult.Key.Instructions.size()));

llvm/unittests/Support/ErrorTest.cpp

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -472,23 +472,6 @@ TEST(Error, createStringError) {
472472
<< "Failed to convert createStringError() result to error_code.";
473473
}
474474

475-
TEST(Error, createStringErrorV) {
476-
static llvm::StringRef Bar("bar");
477-
static const std::error_code EC = errc::invalid_argument;
478-
std::string Msg;
479-
raw_string_ostream S(Msg);
480-
logAllUnhandledErrors(createStringErrorV(EC, "foo{0}{1}{2:x}", Bar, 1, 0xff),
481-
S);
482-
EXPECT_EQ(S.str(), "foobar10xff\n")
483-
<< "Unexpected createStringErrorV() log result";
484-
485-
S.flush();
486-
Msg.clear();
487-
auto Res = errorToErrorCode(createStringErrorV(EC, "foo{0}", Bar));
488-
EXPECT_EQ(Res, EC)
489-
<< "Failed to convert createStringErrorV() result to error_code.";
490-
}
491-
492475
// Test that the ExitOnError utility works as expected.
493476
TEST(ErrorDeathTest, ExitOnError) {
494477
ExitOnError ExitOnErr;

llvm/unittests/TargetParser/TripleTest.cpp

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1205,86 +1205,102 @@ TEST(TripleTest, MutateName) {
12051205
EXPECT_EQ("i386-pc-darwin", T.getTriple());
12061206
}
12071207

1208-
TEST(TripleTest, BitWidthPredicates) {
1208+
TEST(TripleTest, BitWidthChecks) {
12091209
Triple T;
12101210
EXPECT_FALSE(T.isArch16Bit());
12111211
EXPECT_FALSE(T.isArch32Bit());
12121212
EXPECT_FALSE(T.isArch64Bit());
1213+
EXPECT_EQ(T.getArchPointerBitWidth(), 0U);
12131214

12141215
T.setArch(Triple::arm);
12151216
EXPECT_FALSE(T.isArch16Bit());
12161217
EXPECT_TRUE(T.isArch32Bit());
12171218
EXPECT_FALSE(T.isArch64Bit());
1219+
EXPECT_EQ(T.getArchPointerBitWidth(), 32U);
12181220

12191221
T.setArch(Triple::hexagon);
12201222
EXPECT_FALSE(T.isArch16Bit());
12211223
EXPECT_TRUE(T.isArch32Bit());
12221224
EXPECT_FALSE(T.isArch64Bit());
1225+
EXPECT_EQ(T.getArchPointerBitWidth(), 32U);
12231226

12241227
T.setArch(Triple::mips);
12251228
EXPECT_FALSE(T.isArch16Bit());
12261229
EXPECT_TRUE(T.isArch32Bit());
12271230
EXPECT_FALSE(T.isArch64Bit());
1231+
EXPECT_EQ(T.getArchPointerBitWidth(), 32U);
12281232

12291233
T.setArch(Triple::mips64);
12301234
EXPECT_FALSE(T.isArch16Bit());
12311235
EXPECT_FALSE(T.isArch32Bit());
12321236
EXPECT_TRUE(T.isArch64Bit());
1237+
EXPECT_EQ(T.getArchPointerBitWidth(), 64U);
12331238

12341239
T.setArch(Triple::msp430);
12351240
EXPECT_TRUE(T.isArch16Bit());
12361241
EXPECT_FALSE(T.isArch32Bit());
12371242
EXPECT_FALSE(T.isArch64Bit());
1243+
EXPECT_EQ(T.getArchPointerBitWidth(), 16U);
12381244

12391245
T.setArch(Triple::ppc);
12401246
EXPECT_FALSE(T.isArch16Bit());
12411247
EXPECT_TRUE(T.isArch32Bit());
12421248
EXPECT_FALSE(T.isArch64Bit());
1249+
EXPECT_EQ(T.getArchPointerBitWidth(), 32U);
12431250

12441251
T.setArch(Triple::ppc64);
12451252
EXPECT_FALSE(T.isArch16Bit());
12461253
EXPECT_FALSE(T.isArch32Bit());
12471254
EXPECT_TRUE(T.isArch64Bit());
1255+
EXPECT_EQ(T.getArchPointerBitWidth(), 64U);
12481256

12491257
T.setArch(Triple::x86);
12501258
EXPECT_FALSE(T.isArch16Bit());
12511259
EXPECT_TRUE(T.isArch32Bit());
12521260
EXPECT_FALSE(T.isArch64Bit());
1261+
EXPECT_EQ(T.getArchPointerBitWidth(), 32U);
12531262

12541263
T.setArch(Triple::x86_64);
12551264
EXPECT_FALSE(T.isArch16Bit());
12561265
EXPECT_FALSE(T.isArch32Bit());
12571266
EXPECT_TRUE(T.isArch64Bit());
1267+
EXPECT_EQ(T.getArchPointerBitWidth(), 64U);
12581268

12591269
T.setArch(Triple::amdil);
12601270
EXPECT_FALSE(T.isArch16Bit());
12611271
EXPECT_TRUE(T.isArch32Bit());
12621272
EXPECT_FALSE(T.isArch64Bit());
1273+
EXPECT_EQ(T.getArchPointerBitWidth(), 32U);
12631274

12641275
T.setArch(Triple::amdil64);
12651276
EXPECT_FALSE(T.isArch16Bit());
12661277
EXPECT_FALSE(T.isArch32Bit());
12671278
EXPECT_TRUE(T.isArch64Bit());
1279+
EXPECT_EQ(T.getArchPointerBitWidth(), 64U);
12681280

12691281
T.setArch(Triple::hsail);
12701282
EXPECT_FALSE(T.isArch16Bit());
12711283
EXPECT_TRUE(T.isArch32Bit());
12721284
EXPECT_FALSE(T.isArch64Bit());
1285+
EXPECT_EQ(T.getArchPointerBitWidth(), 32U);
12731286

12741287
T.setArch(Triple::hsail64);
12751288
EXPECT_FALSE(T.isArch16Bit());
12761289
EXPECT_FALSE(T.isArch32Bit());
12771290
EXPECT_TRUE(T.isArch64Bit());
1291+
EXPECT_EQ(T.getArchPointerBitWidth(), 64U);
12781292

12791293
T.setArch(Triple::spir);
12801294
EXPECT_FALSE(T.isArch16Bit());
12811295
EXPECT_TRUE(T.isArch32Bit());
12821296
EXPECT_FALSE(T.isArch64Bit());
1297+
EXPECT_EQ(T.getArchPointerBitWidth(), 32U);
12831298

12841299
T.setArch(Triple::spir64);
12851300
EXPECT_FALSE(T.isArch16Bit());
12861301
EXPECT_FALSE(T.isArch32Bit());
12871302
EXPECT_TRUE(T.isArch64Bit());
1303+
EXPECT_EQ(T.getArchPointerBitWidth(), 64U);
12881304

12891305
T.setArch(Triple::spirv);
12901306
EXPECT_FALSE(T.isArch16Bit());

llvm/utils/gn/secondary/libcxx/include/BUILD.gn

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,8 @@ if (current_toolchain == default_toolchain) {
369369
"__chrono/steady_clock.h",
370370
"__chrono/system_clock.h",
371371
"__chrono/time_point.h",
372+
"__chrono/time_zone.h",
373+
"__chrono/time_zone_link.h",
372374
"__chrono/tzdb.h",
373375
"__chrono/tzdb_list.h",
374376
"__chrono/weekday.h",

llvm/utils/gn/secondary/libcxx/src/BUILD.gn

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,13 @@ if (libcxx_enable_experimental) {
315315
sources = [ "experimental/keep.cpp" ]
316316
if (libcxx_enable_filesystem && libcxx_enable_time_zone_database) {
317317
sources += [
318-
"tz.cpp",
318+
"include/tzdb/time_zone_link_private.h",
319+
"include/tzdb/time_zone_private.h",
320+
"include/tzdb/types_private.h",
321+
"include/tzdb/tzdb_list_private.h",
322+
"include/tzdb/tzdb_private.h",
323+
"time_zone.cpp",
324+
"tzdb.cpp",
319325
"tzdb_list.cpp",
320326
]
321327
}

0 commit comments

Comments
 (0)