Skip to content

Commit da777e3

Browse files
SC llvm teamSC llvm team
authored andcommitted
Merged main:386f3903910a into amd-gfx:124a34d59ffc
Local branch amd-gfx 124a34d Merged main:a3937c46d0ea into amd-gfx:100685c57eaa Remote branch main 386f390 [MachineBasicBlock] Fix SlotIndexUpdater for insertion order (llvm#69424)
2 parents 124a34d + 386f390 commit da777e3

File tree

9 files changed

+33
-30
lines changed

9 files changed

+33
-30
lines changed

clang/lib/Serialization/ASTReader.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10115,8 +10115,7 @@ void ASTReader::pushExternalDeclIntoScope(NamedDecl *D, DeclarationName Name) {
1011510115
// Adding the decl to IdResolver may have failed because it was already in
1011610116
// (even though it was not added in scope). If it is already in, make sure
1011710117
// it gets in the scope as well.
10118-
if (std::find(SemaObj->IdResolver.begin(Name),
10119-
SemaObj->IdResolver.end(), D) != SemaObj->IdResolver.end())
10118+
if (llvm::is_contained(SemaObj->IdResolver.decls(Name), D))
1012010119
SemaObj->TUScope->AddDecl(D);
1012110120
}
1012210121
}

compiler-rt/lib/builtins/int_to_fp.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,19 @@ enum {
5353
typedef double dst_t;
5454
typedef uint64_t dst_rep_t;
5555
#define DST_REP_C UINT64_C
56-
static const int dstSigBits = 52;
56+
57+
enum {
58+
dstSigBits = 52,
59+
};
5760

5861
#elif defined DST_QUAD
5962
typedef long double dst_t;
6063
typedef __uint128_t dst_rep_t;
6164
#define DST_REP_C (__uint128_t)
62-
static const int dstSigBits = 112;
65+
66+
enum {
67+
dstSigBits = 112,
68+
};
6369

6470
#else
6571
#error Destination should be a handled floating point type

compiler-rt/test/profile/Windows/coverage-weak-lld.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
// RUN: llvm-profdata show %t.profraw --all-functions | FileCheck %s --check-prefix=PROFILE1
1515

1616
/// link.exe does not support weak overridding weak.
17-
// RUN: %clang_profgen -fcoverage-mapping -fuse-ld=lld -Wl,-lldmingw,-opt:ref %t0.o %t2.o -o %t2
17+
// RUN: %clang_profgen -fcoverage-mapping -fuse-ld=lld -Wl,-lld-allow-duplicate-weak,-opt:ref %t0.o %t2.o -o %t2
1818
// RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t2 | FileCheck %s --check-prefix=CHECK2
1919
// RUN: llvm-profdata show %t.profraw --all-functions | FileCheck %s --check-prefix=PROFILE2
2020

@@ -30,7 +30,7 @@
3030
// RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t1 | FileCheck %s --check-prefix=CHECK1
3131
// RUN: llvm-profdata show %t.profraw --all-functions | FileCheck %s --check-prefix=PROFILE1
3232

33-
// RUN: %clang_profgen -fcoverage-mapping -fuse-ld=lld -Wl,-lldmingw,-opt:ref %t0.o %t2.o -o %t2
33+
// RUN: %clang_profgen -fcoverage-mapping -fuse-ld=lld -Wl,-lld-allow-duplicate-weak,-opt:ref %t0.o %t2.o -o %t2
3434
// RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t2 | FileCheck %s --check-prefix=CHECK2
3535
// RUN: llvm-profdata show %t.profraw --all-functions | FileCheck %s --check-prefix=PROFILE2
3636

flang/lib/Semantics/data-to-inits.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -773,8 +773,7 @@ static bool CombineEquivalencedInitialization(
773773
return false;
774774
}
775775
// If the items are in static storage, save the final initialization.
776-
if (std::find_if(associated.begin(), associated.end(),
777-
[](SymbolRef ref) { return IsSaved(*ref); }) != associated.end()) {
776+
if (llvm::any_of(associated, [](SymbolRef ref) { return IsSaved(*ref); })) {
778777
// Create a compiler array temp that overlaps all the items.
779778
SourceName name{exprAnalyzer.context().GetTempName(scope)};
780779
auto emplaced{

llvm/cmake/modules/HandleLLVMOptions.cmake

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,13 @@ if( LLVM_ENABLE_ASSERTIONS )
111111
endif()
112112
# Enable assertions in libstdc++.
113113
add_compile_definitions(_GLIBCXX_ASSERTIONS)
114-
# Enable the hardened mode in libc++.
115-
add_compile_definitions(_LIBCPP_ENABLE_HARDENED_MODE)
114+
# Cautiously enable the safe hardened mode in libc++.
115+
if((DEFINED LIBCXX_HARDENING_MODE) AND
116+
(NOT LIBCXX_HARDENING_MODE STREQUAL "safe"))
117+
message(WARNING "LLVM_ENABLE_ASSERTIONS implies LIBCXX_HARDENING_MODE \"safe\" but is overriden from command line with value \"${LIBCXX_HARDENING_MODE}\".")
118+
else()
119+
set(LIBCXX_HARDENING_MODE "safe")
120+
endif()
116121
endif()
117122

118123
if(LLVM_ENABLE_EXPENSIVE_CHECKS)

llvm/include/llvm/Config/llvm-config.h.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
/* Indicate that this is LLVM compiled from the amd-gfx branch. */
1818
#define LLVM_HAVE_BRANCH_AMD_GFX
19-
#define LLVM_MAIN_REVISION 478240
19+
#define LLVM_MAIN_REVISION 478248
2020

2121
/* Define if LLVM_ENABLE_DUMP is enabled */
2222
#cmakedefine LLVM_ENABLE_DUMP

llvm/lib/CodeGen/MachineBasicBlock.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1101,22 +1101,28 @@ class SlotIndexUpdateDelegate : public MachineFunction::Delegate {
11011101
private:
11021102
MachineFunction &MF;
11031103
SlotIndexes *Indexes;
1104+
SmallSetVector<MachineInstr *, 2> Insertions;
11041105

11051106
public:
11061107
SlotIndexUpdateDelegate(MachineFunction &MF, SlotIndexes *Indexes)
11071108
: MF(MF), Indexes(Indexes) {
11081109
MF.setDelegate(this);
11091110
}
11101111

1111-
~SlotIndexUpdateDelegate() { MF.resetDelegate(this); }
1112+
~SlotIndexUpdateDelegate() {
1113+
MF.resetDelegate(this);
1114+
for (auto MI : Insertions)
1115+
Indexes->insertMachineInstrInMaps(*MI);
1116+
}
11121117

11131118
void MF_HandleInsertion(MachineInstr &MI) override {
1119+
// This is called before MI is inserted into block so defer index update.
11141120
if (Indexes)
1115-
Indexes->insertMachineInstrInMaps(MI);
1121+
Insertions.insert(&MI);
11161122
}
11171123

11181124
void MF_HandleRemoval(MachineInstr &MI) override {
1119-
if (Indexes)
1125+
if (Indexes && !Insertions.remove(&MI))
11201126
Indexes->removeMachineInstrFromMaps(MI);
11211127
}
11221128
};

llvm/lib/DebugInfo/LogicalView/Core/LVScope.cpp

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -299,20 +299,12 @@ void LVScope::addMissingElements(LVScope *Reference) {
299299
LVSymbols References;
300300
References.append(ReferenceSymbols->begin(), ReferenceSymbols->end());
301301

302-
auto RemoveSymbol = [&](LVSymbols &Symbols, LVSymbol *Symbol) {
303-
LVSymbols::iterator Iter = std::remove_if(
304-
Symbols.begin(), Symbols.end(),
305-
[Symbol](LVSymbol *Item) -> bool { return Item == Symbol; });
306-
if (Iter != Symbols.end())
307-
Symbols.erase(Iter, Symbols.end());
308-
};
309-
310302
// Erase abstract symbols already in this scope from the collection of
311303
// symbols in the referenced scope.
312304
if (getSymbols())
313305
for (const LVSymbol *Symbol : *getSymbols())
314306
if (Symbol->getHasReferenceAbstract())
315-
RemoveSymbol(References, Symbol->getReference());
307+
llvm::erase_value(References, Symbol->getReference());
316308

317309
// If we have elements left in 'References', those are the elements that
318310
// need to be inserted in the current scope.

polly/lib/Analysis/ScopInfo.cpp

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1647,9 +1647,7 @@ void Scop::removeFromStmtMap(ScopStmt &Stmt) {
16471647
} else {
16481648
auto StmtMapIt = StmtMap.find(Stmt.getBasicBlock());
16491649
if (StmtMapIt != StmtMap.end())
1650-
StmtMapIt->second.erase(std::remove(StmtMapIt->second.begin(),
1651-
StmtMapIt->second.end(), &Stmt),
1652-
StmtMapIt->second.end());
1650+
llvm::erase_value(StmtMapIt->second, &Stmt);
16531651
for (Instruction *Inst : Stmt.getInstructions())
16541652
InstStmtMap.erase(Inst);
16551653
}
@@ -2424,15 +2422,13 @@ void Scop::removeAccessData(MemoryAccess *Access) {
24242422
ValueDefAccs.erase(Access->getAccessValue());
24252423
} else if (Access->isOriginalValueKind() && Access->isRead()) {
24262424
auto &Uses = ValueUseAccs[Access->getScopArrayInfo()];
2427-
auto NewEnd = std::remove(Uses.begin(), Uses.end(), Access);
2428-
Uses.erase(NewEnd, Uses.end());
2425+
llvm::erase_value(Uses, Access);
24292426
} else if (Access->isOriginalPHIKind() && Access->isRead()) {
24302427
PHINode *PHI = cast<PHINode>(Access->getAccessInstruction());
24312428
PHIReadAccs.erase(PHI);
24322429
} else if (Access->isOriginalAnyPHIKind() && Access->isWrite()) {
24332430
auto &Incomings = PHIIncomingAccs[Access->getScopArrayInfo()];
2434-
auto NewEnd = std::remove(Incomings.begin(), Incomings.end(), Access);
2435-
Incomings.erase(NewEnd, Incomings.end());
2431+
llvm::erase_value(Incomings, Access);
24362432
}
24372433
}
24382434

0 commit comments

Comments
 (0)