Skip to content

Commit 922c3da

Browse files
SC llvm teamSC llvm team
authored andcommitted
Merged main:5d8354c009d5625fa140be47de1f91275f4698d3 into amd-gfx:065d13b47a5a
Local branch amd-gfx 065d13b Merged main:bf1d4172335689f62e4f7368446f0026c595330b into amd-gfx:a88bc3181d9c Remote branch main 5d8354c [Flang][OpenMP]Missing convert to lhsType in atomic write (llvm#92346)
2 parents 065d13b + 5d8354c commit 922c3da

File tree

23 files changed

+190
-154
lines changed

23 files changed

+190
-154
lines changed

bolt/include/bolt/Profile/DataAggregator.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,14 +122,14 @@ class DataAggregator : public DataReader {
122122
uint64_t ExternCount{0};
123123
};
124124

125-
struct BranchInfo {
125+
struct TakenBranchInfo {
126126
uint64_t TakenCount{0};
127127
uint64_t MispredCount{0};
128128
};
129129

130130
/// Intermediate storage for profile data. We save the results of parsing
131131
/// and use them later for processing and assigning profile.
132-
std::unordered_map<Trace, BranchInfo, TraceHash> BranchLBRs;
132+
std::unordered_map<Trace, TakenBranchInfo, TraceHash> BranchLBRs;
133133
std::unordered_map<Trace, FTInfo, TraceHash> FallthroughLBRs;
134134
std::vector<AggregatedLBREntry> AggregatedLBRs;
135135
std::unordered_map<uint64_t, uint64_t> BasicSamples;

bolt/lib/Profile/DataAggregator.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1464,7 +1464,7 @@ uint64_t DataAggregator::parseLBRSample(const PerfBranchSample &Sample,
14641464
uint64_t To = getBinaryFunctionContainingAddress(LBR.To) ? LBR.To : 0;
14651465
if (!From && !To)
14661466
continue;
1467-
BranchInfo &Info = BranchLBRs[Trace(From, To)];
1467+
TakenBranchInfo &Info = BranchLBRs[Trace(From, To)];
14681468
++Info.TakenCount;
14691469
Info.MispredCount += LBR.Mispred;
14701470
}
@@ -1609,7 +1609,7 @@ void DataAggregator::processBranchEvents() {
16091609

16101610
for (const auto &AggrLBR : BranchLBRs) {
16111611
const Trace &Loc = AggrLBR.first;
1612-
const BranchInfo &Info = AggrLBR.second;
1612+
const TakenBranchInfo &Info = AggrLBR.second;
16131613
doBranch(Loc.From, Loc.To, Info.TakenCount, Info.MispredCount);
16141614
}
16151615
}
@@ -2253,13 +2253,13 @@ DataAggregator::writeAggregatedFile(StringRef OutputFilename) const {
22532253
} else {
22542254
for (const auto &KV : NamesToBranches) {
22552255
const FuncBranchData &FBD = KV.second;
2256-
for (const llvm::bolt::BranchInfo &BI : FBD.Data) {
2256+
for (const BranchInfo &BI : FBD.Data) {
22572257
writeLocation(BI.From);
22582258
writeLocation(BI.To);
22592259
OutFile << BI.Mispreds << " " << BI.Branches << "\n";
22602260
++BranchValues;
22612261
}
2262-
for (const llvm::bolt::BranchInfo &BI : FBD.EntryData) {
2262+
for (const BranchInfo &BI : FBD.EntryData) {
22632263
// Do not output if source is a known symbol, since this was already
22642264
// accounted for in the source function
22652265
if (BI.From.IsSymbol)
@@ -2366,7 +2366,7 @@ std::error_code DataAggregator::writeBATYAML(BinaryContext &BC,
23662366
return std::pair(BlockIt->first, BlockIt->second.getBBIndex());
23672367
};
23682368

2369-
for (const llvm::bolt::BranchInfo &BI : Branches.Data) {
2369+
for (const BranchInfo &BI : Branches.Data) {
23702370
using namespace yaml::bolt;
23712371
const auto &[BlockOffset, BlockIndex] = getBlock(BI.From.Offset);
23722372
BinaryBasicBlockProfile &YamlBB = YamlBF.Blocks[BlockIndex];
@@ -2388,7 +2388,7 @@ std::error_code DataAggregator::writeBATYAML(BinaryContext &BC,
23882388
}
23892389
}
23902390
// Set entry counts, similar to DataReader::readProfile.
2391-
for (const llvm::bolt::BranchInfo &BI : Branches.EntryData) {
2391+
for (const BranchInfo &BI : Branches.EntryData) {
23922392
if (!BlockMap.isInputBlock(BI.To.Offset)) {
23932393
if (opts::Verbosity >= 1)
23942394
errs() << "BOLT-WARNING: Unexpected EntryData in " << FuncName

clang/lib/Format/TokenAnnotator.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5601,10 +5601,13 @@ bool TokenAnnotator::mustBreakBefore(const AnnotatedLine &Line,
56015601
return true;
56025602
if (Left.IsUnterminatedLiteral)
56035603
return true;
5604-
if (Right.is(tok::lessless) && AfterRight && Left.is(tok::string_literal) &&
5604+
5605+
if (BeforeLeft && BeforeLeft->is(tok::lessless) &&
5606+
Left.is(tok::string_literal) && Right.is(tok::lessless) && AfterRight &&
56055607
AfterRight->is(tok::string_literal)) {
5606-
return true;
5608+
return Right.NewlinesBefore > 0;
56075609
}
5610+
56085611
if (Right.is(TT_RequiresClause)) {
56095612
switch (Style.RequiresClausePosition) {
56105613
case FormatStyle::RCPS_OwnLine:

clang/lib/Format/UnwrappedLineParser.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4008,18 +4008,20 @@ void UnwrappedLineParser::parseRecord(bool ParseAsExpr) {
40084008
};
40094009

40104010
if (FormatTok->isOneOf(tok::colon, tok::less)) {
4011-
if (FormatTok->is(tok::colon))
4012-
IsDerived = true;
40134011
int AngleNestingLevel = 0;
40144012
do {
40154013
if (FormatTok->is(tok::less))
40164014
++AngleNestingLevel;
40174015
else if (FormatTok->is(tok::greater))
40184016
--AngleNestingLevel;
40194017

4020-
if (AngleNestingLevel == 0 && FormatTok->is(tok::l_paren) &&
4021-
IsNonMacroIdentifier(FormatTok->Previous)) {
4022-
break;
4018+
if (AngleNestingLevel == 0) {
4019+
if (FormatTok->is(tok::colon)) {
4020+
IsDerived = true;
4021+
} else if (FormatTok->is(tok::l_paren) &&
4022+
IsNonMacroIdentifier(FormatTok->Previous)) {
4023+
break;
4024+
}
40234025
}
40244026
if (FormatTok->is(tok::l_brace)) {
40254027
if (AngleNestingLevel == 0 && IsListInitialization())

clang/unittests/Format/FormatTest.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10539,6 +10539,17 @@ TEST_F(FormatTest, KeepStringLabelValuePairsOnALine) {
1053910539
" bbbbbbbbbbbbbbbbbbbbbbb);");
1054010540
}
1054110541

10542+
TEST_F(FormatTest, WrapBeforeInsertionOperatorbetweenStringLiterals) {
10543+
verifyFormat("QStringList() << \"foo\" << \"bar\";");
10544+
10545+
verifyNoChange("QStringList() << \"foo\"\n"
10546+
" << \"bar\";");
10547+
10548+
verifyFormat("log_error(log, \"foo\" << \"bar\");",
10549+
"log_error(log, \"foo\"\n"
10550+
" << \"bar\");");
10551+
}
10552+
1054210553
TEST_F(FormatTest, UnderstandsEquals) {
1054310554
verifyFormat(
1054410555
"aaaaaaaaaaaaaaaaa =\n"

clang/unittests/Format/TokenAnnotatorTest.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2903,6 +2903,11 @@ TEST_F(TokenAnnotatorTest, BraceKind) {
29032903
EXPECT_BRACE_KIND(Tokens[5], BK_Block);
29042904
EXPECT_BRACE_KIND(Tokens[6], BK_Block);
29052905

2906+
Tokens = annotate("struct Foo<int> : Base {};");
2907+
ASSERT_EQ(Tokens.size(), 11u) << Tokens;
2908+
EXPECT_BRACE_KIND(Tokens[7], BK_Block);
2909+
EXPECT_BRACE_KIND(Tokens[8], BK_Block);
2910+
29062911
Tokens = annotate("struct Foo final {};");
29072912
ASSERT_EQ(Tokens.size(), 7u) << Tokens;
29082913
EXPECT_BRACE_KIND(Tokens[3], BK_Block);

flang/lib/Lower/DirectivesCommon.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,9 @@ static inline void genOmpAccAtomicWriteStatement(
180180
// Generate `atomic.write` operation for atomic assignment statements
181181
fir::FirOpBuilder &firOpBuilder = converter.getFirOpBuilder();
182182

183+
mlir::Type varType = fir::unwrapRefType(lhsAddr.getType());
184+
rhsExpr = firOpBuilder.createConvert(loc, varType, rhsExpr);
185+
183186
if constexpr (std::is_same<AtomicListT,
184187
Fortran::parser::OmpAtomicClauseList>()) {
185188
// If no hint clause is specified, the effect is as if

flang/test/Lower/OpenMP/atomic-write.f90

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,17 @@ subroutine atomic_write_typed_assign
7373
!$omp atomic write
7474
r2 = 0
7575
end subroutine
76+
77+
!CHECK-LABEL: func.func @_QPatomic_write_logical()
78+
!CHECK: %[[L_REF:.*]] = fir.alloca !fir.logical<4> {bindc_name = "l", uniq_name = "_QFatomic_write_logicalEl"}
79+
!CHECK: %[[L_DECL:.*]]:2 = hlfir.declare %[[L_REF]] {uniq_name = "_QFatomic_write_logicalEl"} : (!fir.ref<!fir.logical<4>>) -> (!fir.ref<!fir.logical<4>>, !fir.ref<!fir.logical<4>>)
80+
!CHECK: %true = arith.constant true
81+
!CHECK: %[[CVT:.*]] = fir.convert %true : (i1) -> !fir.logical<4>
82+
!CHECK: omp.atomic.write %[[L_DECL]]#1 = %[[CVT]] : !fir.ref<!fir.logical<4>>, !fir.logical<4>
83+
84+
subroutine atomic_write_logical
85+
logical :: l
86+
!$omp atomic write
87+
l = .true.
88+
!$omp end atomic
89+
end

lldb/source/Commands/CommandObjectThread.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,14 +151,14 @@ class CommandObjectThreadBacktrace : public CommandObjectIterateOverThreads {
151151

152152
for (size_t idx = 0; idx < num_entries; idx++) {
153153
llvm::StringRef arg_string = copy_args[idx].ref();
154-
if (arg_string.equals("-c") || count_opt.starts_with(arg_string)) {
154+
if (arg_string == "-c" || count_opt.starts_with(arg_string)) {
155155
idx++;
156156
if (idx == num_entries)
157157
return std::nullopt;
158158
count_idx = idx;
159159
if (copy_args[idx].ref().getAsInteger(0, count_val))
160160
return std::nullopt;
161-
} else if (arg_string.equals("-s") || start_opt.starts_with(arg_string)) {
161+
} else if (arg_string == "-s" || start_opt.starts_with(arg_string)) {
162162
idx++;
163163
if (idx == num_entries)
164164
return std::nullopt;

lldb/source/Core/FormatEntity.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1921,7 +1921,7 @@ static Status ParseEntry(const llvm::StringRef &format_str,
19211921
const size_t n = parent->num_children;
19221922
for (size_t i = 0; i < n; ++i) {
19231923
const Definition *entry_def = parent->children + i;
1924-
if (key.equals(entry_def->name) || entry_def->name[0] == '*') {
1924+
if (key == entry_def->name || entry_def->name[0] == '*') {
19251925
llvm::StringRef value;
19261926
if (sep_char)
19271927
value =
@@ -2002,7 +2002,7 @@ static const Definition *FindEntry(const llvm::StringRef &format_str,
20022002
const size_t n = parent->num_children;
20032003
for (size_t i = 0; i < n; ++i) {
20042004
const Definition *entry_def = parent->children + i;
2005-
if (p.first.equals(entry_def->name) || entry_def->name[0] == '*') {
2005+
if (p.first == entry_def->name || entry_def->name[0] == '*') {
20062006
if (p.second.empty()) {
20072007
if (format_str.back() == '.')
20082008
remainder = format_str.drop_front(format_str.size() - 1);
@@ -2351,13 +2351,13 @@ Status FormatEntity::ExtractVariableInfo(llvm::StringRef &format_str,
23512351
bool FormatEntity::FormatFileSpec(const FileSpec &file_spec, Stream &s,
23522352
llvm::StringRef variable_name,
23532353
llvm::StringRef variable_format) {
2354-
if (variable_name.empty() || variable_name.equals(".fullpath")) {
2354+
if (variable_name.empty() || variable_name == ".fullpath") {
23552355
file_spec.Dump(s.AsRawOstream());
23562356
return true;
2357-
} else if (variable_name.equals(".basename")) {
2357+
} else if (variable_name == ".basename") {
23582358
s.PutCString(file_spec.GetFilename().GetStringRef());
23592359
return true;
2360-
} else if (variable_name.equals(".dirname")) {
2360+
} else if (variable_name == ".dirname") {
23612361
s.PutCString(file_spec.GetFilename().GetStringRef());
23622362
return true;
23632363
}
@@ -2440,7 +2440,7 @@ void FormatEntity::AutoComplete(CompletionRequest &request) {
24402440
// "${thread.id" <TAB>
24412441
request.AddCompletion(MakeMatch(str, "}"));
24422442
}
2443-
} else if (remainder.equals(".")) {
2443+
} else if (remainder == ".") {
24442444
// "${thread." <TAB>
24452445
StringList new_matches;
24462446
AddMatches(entry_def, str, llvm::StringRef(), new_matches);

lldb/source/Expression/IRExecutionUnit.cpp

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -534,63 +534,63 @@ lldb::SectionType IRExecutionUnit::GetSectionTypeFromSectionName(
534534
}
535535

536536
if (!name.empty()) {
537-
if (name.equals("__text") || name.equals(".text"))
537+
if (name == "__text" || name == ".text")
538538
sect_type = lldb::eSectionTypeCode;
539-
else if (name.equals("__data") || name.equals(".data"))
539+
else if (name == "__data" || name == ".data")
540540
sect_type = lldb::eSectionTypeCode;
541541
else if (name.starts_with("__debug_") || name.starts_with(".debug_")) {
542542
const uint32_t name_idx = name[0] == '_' ? 8 : 7;
543543
llvm::StringRef dwarf_name(name.substr(name_idx));
544544
switch (dwarf_name[0]) {
545545
case 'a':
546-
if (dwarf_name.equals("abbrev"))
546+
if (dwarf_name == "abbrev")
547547
sect_type = lldb::eSectionTypeDWARFDebugAbbrev;
548-
else if (dwarf_name.equals("aranges"))
548+
else if (dwarf_name == "aranges")
549549
sect_type = lldb::eSectionTypeDWARFDebugAranges;
550-
else if (dwarf_name.equals("addr"))
550+
else if (dwarf_name == "addr")
551551
sect_type = lldb::eSectionTypeDWARFDebugAddr;
552552
break;
553553

554554
case 'f':
555-
if (dwarf_name.equals("frame"))
555+
if (dwarf_name == "frame")
556556
sect_type = lldb::eSectionTypeDWARFDebugFrame;
557557
break;
558558

559559
case 'i':
560-
if (dwarf_name.equals("info"))
560+
if (dwarf_name == "info")
561561
sect_type = lldb::eSectionTypeDWARFDebugInfo;
562562
break;
563563

564564
case 'l':
565-
if (dwarf_name.equals("line"))
565+
if (dwarf_name == "line")
566566
sect_type = lldb::eSectionTypeDWARFDebugLine;
567-
else if (dwarf_name.equals("loc"))
567+
else if (dwarf_name == "loc")
568568
sect_type = lldb::eSectionTypeDWARFDebugLoc;
569-
else if (dwarf_name.equals("loclists"))
569+
else if (dwarf_name == "loclists")
570570
sect_type = lldb::eSectionTypeDWARFDebugLocLists;
571571
break;
572572

573573
case 'm':
574-
if (dwarf_name.equals("macinfo"))
574+
if (dwarf_name == "macinfo")
575575
sect_type = lldb::eSectionTypeDWARFDebugMacInfo;
576576
break;
577577

578578
case 'p':
579-
if (dwarf_name.equals("pubnames"))
579+
if (dwarf_name == "pubnames")
580580
sect_type = lldb::eSectionTypeDWARFDebugPubNames;
581-
else if (dwarf_name.equals("pubtypes"))
581+
else if (dwarf_name == "pubtypes")
582582
sect_type = lldb::eSectionTypeDWARFDebugPubTypes;
583583
break;
584584

585585
case 's':
586-
if (dwarf_name.equals("str"))
586+
if (dwarf_name == "str")
587587
sect_type = lldb::eSectionTypeDWARFDebugStr;
588-
else if (dwarf_name.equals("str_offsets"))
588+
else if (dwarf_name == "str_offsets")
589589
sect_type = lldb::eSectionTypeDWARFDebugStrOffsets;
590590
break;
591591

592592
case 'r':
593-
if (dwarf_name.equals("ranges"))
593+
if (dwarf_name == "ranges")
594594
sect_type = lldb::eSectionTypeDWARFDebugRanges;
595595
break;
596596

@@ -599,7 +599,7 @@ lldb::SectionType IRExecutionUnit::GetSectionTypeFromSectionName(
599599
}
600600
} else if (name.starts_with("__apple_") || name.starts_with(".apple_"))
601601
sect_type = lldb::eSectionTypeInvalid;
602-
else if (name.equals("__objc_imageinfo"))
602+
else if (name == "__objc_imageinfo")
603603
sect_type = lldb::eSectionTypeOther;
604604
}
605605
return sect_type;

lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1449,7 +1449,7 @@ bool IRForTarget::ReplaceVariables(Function &llvm_function) {
14491449

14501450
Argument *argument = &*iter;
14511451

1452-
if (argument->getName().equals("this")) {
1452+
if (argument->getName() == "this") {
14531453
++iter;
14541454

14551455
if (iter == llvm_function.arg_end()) {
@@ -1461,7 +1461,7 @@ bool IRForTarget::ReplaceVariables(Function &llvm_function) {
14611461
}
14621462

14631463
argument = &*iter;
1464-
} else if (argument->getName().equals("self")) {
1464+
} else if (argument->getName() == "self") {
14651465
++iter;
14661466

14671467
if (iter == llvm_function.arg_end()) {
@@ -1472,7 +1472,7 @@ bool IRForTarget::ReplaceVariables(Function &llvm_function) {
14721472
return false;
14731473
}
14741474

1475-
if (!iter->getName().equals("_cmd")) {
1475+
if (iter->getName() != "_cmd") {
14761476
m_error_stream.Format("Internal error [IRForTarget]: Wrapper takes '{0}' "
14771477
"after 'self' argument (should take '_cmd')",
14781478
iter->getName());
@@ -1493,7 +1493,7 @@ bool IRForTarget::ReplaceVariables(Function &llvm_function) {
14931493
argument = &*iter;
14941494
}
14951495

1496-
if (!argument->getName().equals("$__lldb_arg")) {
1496+
if (argument->getName() != "$__lldb_arg") {
14971497
m_error_stream.Format("Internal error [IRForTarget]: Wrapper takes an "
14981498
"argument named '{0}' instead of the struct pointer",
14991499
argument->getName());

lldb/source/Plugins/Language/ObjC/Cocoa.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -802,7 +802,7 @@ bool lldb_private::formatters::NSURLSummaryProvider(
802802

803803
llvm::StringRef class_name = descriptor->GetClassName().GetStringRef();
804804

805-
if (!class_name.equals("NSURL"))
805+
if (class_name != "NSURL")
806806
return false;
807807

808808
uint64_t offset_text = ptr_size + ptr_size +

lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3557,7 +3557,7 @@ ObjectFile::Strata ObjectFileELF::CalculateStrata() {
35573557
// decrease by one
35583558
llvm::StringRef loader_name(buffer, read_size - 1);
35593559
llvm::StringRef freebsd_kernel_loader_name("/red/herring");
3560-
if (loader_name.equals(freebsd_kernel_loader_name))
3560+
if (loader_name == freebsd_kernel_loader_name)
35613561
return eStrataKernel;
35623562
}
35633563
}

0 commit comments

Comments
 (0)