Skip to content

Commit 49a2ba4

Browse files
authored
Merge branch 'main' into fix-svextq-imm
2 parents ef12a3a + b214ca8 commit 49a2ba4

File tree

123 files changed

+1900
-1140
lines changed

Some content is hidden

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

123 files changed

+1900
-1140
lines changed

bolt/include/bolt/Profile/DataAggregator.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -170,9 +170,6 @@ class DataAggregator : public DataReader {
170170
std::string BuildIDBinaryName;
171171

172172
/// Memory map info for a single file as recorded in perf.data
173-
/// When a binary has multiple text segments, the Size is computed as the
174-
/// difference of the last address of these segments from the BaseAddress.
175-
/// The base addresses of all text segments must be the same.
176173
struct MMapInfo {
177174
uint64_t BaseAddress{0}; /// Base address of the mapped binary.
178175
uint64_t MMapAddress{0}; /// Address of the executable segment.
@@ -496,11 +493,6 @@ class DataAggregator : public DataReader {
496493
/// and return a file name matching a given \p FileBuildID.
497494
std::optional<StringRef> getFileNameForBuildID(StringRef FileBuildID);
498495

499-
/// Get a constant reference to the parsed binary mmap entries.
500-
const std::unordered_map<uint64_t, MMapInfo> &getBinaryMMapInfo() {
501-
return BinaryMMapInfo;
502-
}
503-
504496
friend class YAMLProfileWriter;
505497
};
506498
} // namespace bolt

bolt/lib/Profile/DataAggregator.cpp

Lines changed: 14 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -95,12 +95,6 @@ cl::opt<bool> ReadPreAggregated(
9595
"pa", cl::desc("skip perf and read data from a pre-aggregated file format"),
9696
cl::cat(AggregatorCategory));
9797

98-
cl::opt<std::string>
99-
ReadPerfEvents("perf-script-events",
100-
cl::desc("skip perf event collection by supplying a "
101-
"perf-script output in a textual format"),
102-
cl::ReallyHidden, cl::init(""), cl::cat(AggregatorCategory));
103-
10498
static cl::opt<bool>
10599
TimeAggregator("time-aggr",
106100
cl::desc("time BOLT aggregator"),
@@ -173,9 +167,8 @@ void DataAggregator::findPerfExecutable() {
173167
void DataAggregator::start() {
174168
outs() << "PERF2BOLT: Starting data aggregation job for " << Filename << "\n";
175169

176-
// Don't launch perf for pre-aggregated files or when perf input is specified
177-
// by the user.
178-
if (opts::ReadPreAggregated || !opts::ReadPerfEvents.empty())
170+
// Don't launch perf for pre-aggregated files
171+
if (opts::ReadPreAggregated)
179172
return;
180173

181174
findPerfExecutable();
@@ -471,13 +464,6 @@ void DataAggregator::filterBinaryMMapInfo() {
471464

472465
int DataAggregator::prepareToParse(StringRef Name, PerfProcessInfo &Process,
473466
PerfProcessErrorCallbackTy Callback) {
474-
if (!opts::ReadPerfEvents.empty()) {
475-
outs() << "PERF2BOLT: using pre-processed perf events for '" << Name
476-
<< "' (perf-script-events)\n";
477-
ParsingBuf = opts::ReadPerfEvents;
478-
return 0;
479-
}
480-
481467
std::string Error;
482468
outs() << "PERF2BOLT: waiting for perf " << Name
483469
<< " collection to finish...\n";
@@ -2070,6 +2056,15 @@ std::error_code DataAggregator::parseMMapEvents() {
20702056
if (FileMMapInfo.first == "(deleted)")
20712057
continue;
20722058

2059+
// Consider only the first mapping of the file for any given PID
2060+
auto Range = GlobalMMapInfo.equal_range(FileMMapInfo.first);
2061+
bool PIDExists = llvm::any_of(make_range(Range), [&](const auto &MI) {
2062+
return MI.second.PID == FileMMapInfo.second.PID;
2063+
});
2064+
2065+
if (PIDExists)
2066+
continue;
2067+
20732068
GlobalMMapInfo.insert(FileMMapInfo);
20742069
}
20752070

@@ -2121,22 +2116,12 @@ std::error_code DataAggregator::parseMMapEvents() {
21212116
<< " using file offset 0x" << Twine::utohexstr(MMapInfo.Offset)
21222117
<< ". Ignoring profile data for this mapping\n";
21232118
continue;
2119+
} else {
2120+
MMapInfo.BaseAddress = *BaseAddress;
21242121
}
2125-
MMapInfo.BaseAddress = *BaseAddress;
21262122
}
21272123

2128-
// Try to add MMapInfo to the map and update its size. Large binaries may
2129-
// span to multiple text segments, so the mapping is inserted only on the
2130-
// first occurrence.
2131-
if (!BinaryMMapInfo.insert(std::make_pair(MMapInfo.PID, MMapInfo)).second)
2132-
assert(MMapInfo.BaseAddress == BinaryMMapInfo[MMapInfo.PID].BaseAddress &&
2133-
"Base address on multiple segment mappings should match");
2134-
2135-
// Update mapping size.
2136-
const uint64_t EndAddress = MMapInfo.MMapAddress + MMapInfo.Size;
2137-
const uint64_t Size = EndAddress - BinaryMMapInfo[MMapInfo.PID].BaseAddress;
2138-
if (Size > BinaryMMapInfo[MMapInfo.PID].Size)
2139-
BinaryMMapInfo[MMapInfo.PID].Size = Size;
2124+
BinaryMMapInfo.insert(std::make_pair(MMapInfo.PID, MMapInfo));
21402125
}
21412126

21422127
if (BinaryMMapInfo.empty()) {

bolt/unittests/Core/CMakeLists.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ set(LLVM_LINK_COMPONENTS
88
add_bolt_unittest(CoreTests
99
BinaryContext.cpp
1010
MCPlusBuilder.cpp
11-
MemoryMaps.cpp
1211
DynoStats.cpp
1312

1413
DISABLE_LLVM_LINK_LLVM_DYLIB
@@ -18,8 +17,6 @@ target_link_libraries(CoreTests
1817
PRIVATE
1918
LLVMBOLTCore
2019
LLVMBOLTRewrite
21-
LLVMBOLTProfile
22-
LLVMTestingSupport
2320
)
2421

2522
foreach (tgt ${BOLT_TARGETS_TO_BUILD})

bolt/unittests/Core/MemoryMaps.cpp

Lines changed: 0 additions & 142 deletions
This file was deleted.

clang-tools-extra/docs/ReleaseNotes.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ Hover
7373
Code completion
7474
^^^^^^^^^^^^^^^
7575

76+
- Added completion for C++20 keywords.
77+
7678
Code actions
7779
^^^^^^^^^^^^
7880

clang/docs/LanguageExtensions.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -647,6 +647,9 @@ elementwise to the input.
647647

648648
Unless specified otherwise operation(±0) = ±0 and operation(±infinity) = ±infinity
649649

650+
The integer elementwise intrinsics, including ``__builtin_elementwise_popcount``,
651+
can be called in a ``constexpr`` context.
652+
650653
============================================== ====================================================================== =========================================
651654
Name Operation Supported element types
652655
============================================== ====================================================================== =========================================

clang/docs/ReleaseNotes.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,9 @@ Resolutions to C++ Defect Reports
279279
by default.
280280
(`CWG2521: User-defined literals and reserved identifiers <https://cplusplus.github.io/CWG/issues/2521.html>`_).
281281

282+
- Fix name lookup for a dependent base class that is the current instantiation.
283+
(`CWG591: When a dependent base class is the current instantiation <https://cplusplus.github.io/CWG/issues/591.html>`_).
284+
282285
C Language Changes
283286
------------------
284287

@@ -372,6 +375,7 @@ Non-comprehensive list of changes in this release
372375
- ``__builtin_reduce_mul`` function can now be used in constant expressions.
373376
- ``__builtin_reduce_and`` function can now be used in constant expressions.
374377
- ``__builtin_reduce_or`` and ``__builtin_reduce_xor`` functions can now be used in constant expressions.
378+
- ``__builtin_elementwise_popcount`` function can now be used in constant expressions.
375379

376380
New Compiler Flags
377381
------------------
@@ -587,6 +591,8 @@ Improvements to Clang's diagnostics
587591
- For an rvalue reference bound to a temporary struct with an integer member, Clang will detect constant integer overflow
588592
in the initializer for the integer member (#GH46755).
589593

594+
- Fixed a false negative ``-Wunused-private-field`` diagnostic when a defaulted comparison operator is defined out of class (#GH116961).
595+
590596
Improvements to Clang's time-trace
591597
----------------------------------
592598

@@ -728,6 +734,8 @@ Bug Fixes to AST Handling
728734
sometimes incorrectly return null even if a comment was present. (#GH108145)
729735
- Clang now correctly parses the argument of the ``relates``, ``related``, ``relatesalso``,
730736
and ``relatedalso`` comment commands.
737+
- Clang now uses the location of the begin of the member expression for ``CallExpr``
738+
involving deduced ``this``. (#GH116928)
731739

732740
Miscellaneous Bug Fixes
733741
^^^^^^^^^^^^^^^^^^^^^^^

clang/include/clang/Basic/Builtins.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1354,7 +1354,7 @@ def ElementwiseLog10 : Builtin {
13541354

13551355
def ElementwisePopcount : Builtin {
13561356
let Spellings = ["__builtin_elementwise_popcount"];
1357-
let Attributes = [NoThrow, Const, CustomTypeChecking];
1357+
let Attributes = [NoThrow, Const, CustomTypeChecking, Constexpr];
13581358
let Prototype = "void(...)";
13591359
}
13601360

clang/include/clang/Driver/Options.td

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5417,6 +5417,10 @@ def mld_seq_sa : Flag<["-"], "mld-seq-sa">, Group<m_loongarch_Features_Group>,
54175417
HelpText<"Do not generate load-load barrier instructions (dbar 0x700)">;
54185418
def mno_ld_seq_sa : Flag<["-"], "mno-ld-seq-sa">, Group<m_loongarch_Features_Group>,
54195419
HelpText<"Generate load-load barrier instructions (dbar 0x700)">;
5420+
def mdiv32 : Flag<["-"], "mdiv32">, Group<m_loongarch_Features_Group>,
5421+
HelpText<"Use div.w[u] and mod.w[u] instructions with input not sign-extended.">;
5422+
def mno_div32 : Flag<["-"], "mno-div32">, Group<m_loongarch_Features_Group>,
5423+
HelpText<"Do not use div.w[u] and mod.w[u] instructions with input not sign-extended.">;
54205424
def mannotate_tablejump : Flag<["-"], "mannotate-tablejump">, Group<m_loongarch_Features_Group>,
54215425
HelpText<"Enable annotate table jump instruction to correlate it with the jump table.">;
54225426
def mno_annotate_tablejump : Flag<["-"], "mno-annotate-tablejump">, Group<m_loongarch_Features_Group>,

clang/lib/AST/CXXInheritance.cpp

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ bool CXXRecordDecl::forallBases(ForallBasesCallback BaseMatches) const {
134134
return false;
135135

136136
CXXRecordDecl *Base =
137-
cast_or_null<CXXRecordDecl>(Ty->getDecl()->getDefinition());
137+
cast_if_present<CXXRecordDecl>(Ty->getDecl()->getDefinition());
138138
if (!Base ||
139139
(Base->isDependentContext() &&
140140
!Base->isCurrentInstantiation(Record))) {
@@ -169,13 +169,21 @@ bool CXXBasePaths::lookupInBases(ASTContext &Context,
169169
QualType BaseType =
170170
Context.getCanonicalType(BaseSpec.getType()).getUnqualifiedType();
171171

172+
bool isCurrentInstantiation = isa<InjectedClassNameType>(BaseType);
173+
if (!isCurrentInstantiation) {
174+
if (auto *BaseRecord = cast_if_present<CXXRecordDecl>(
175+
BaseSpec.getType()->getAsRecordDecl()))
176+
isCurrentInstantiation = BaseRecord->isDependentContext() &&
177+
BaseRecord->isCurrentInstantiation(Record);
178+
}
172179
// C++ [temp.dep]p3:
173180
// In the definition of a class template or a member of a class template,
174181
// if a base class of the class template depends on a template-parameter,
175182
// the base class scope is not examined during unqualified name lookup
176183
// either at the point of definition of the class template or member or
177184
// during an instantiation of the class tem- plate or member.
178-
if (!LookupInDependent && BaseType->isDependentType())
185+
if (!LookupInDependent &&
186+
(BaseType->isDependentType() && !isCurrentInstantiation))
179187
continue;
180188

181189
// Determine whether we need to visit this base class at all,
@@ -243,9 +251,8 @@ bool CXXBasePaths::lookupInBases(ASTContext &Context,
243251
return FoundPath;
244252
}
245253
} else if (VisitBase) {
246-
CXXRecordDecl *BaseRecord;
254+
CXXRecordDecl *BaseRecord = nullptr;
247255
if (LookupInDependent) {
248-
BaseRecord = nullptr;
249256
const TemplateSpecializationType *TST =
250257
BaseSpec.getType()->getAs<TemplateSpecializationType>();
251258
if (!TST) {
@@ -264,8 +271,7 @@ bool CXXBasePaths::lookupInBases(ASTContext &Context,
264271
BaseRecord = nullptr;
265272
}
266273
} else {
267-
BaseRecord = cast<CXXRecordDecl>(
268-
BaseSpec.getType()->castAs<RecordType>()->getDecl());
274+
BaseRecord = cast<CXXRecordDecl>(BaseSpec.getType()->getAsRecordDecl());
269275
}
270276
if (BaseRecord &&
271277
lookupInBases(Context, BaseRecord, BaseMatches, LookupInDependent)) {

0 commit comments

Comments
 (0)