Skip to content

Commit 010f535

Browse files
SC llvm teamSC llvm team
authored andcommitted
Merged main:6eee238975e4 into amd-gfx:4d4ec95d174b
Local branch amd-gfx 4d4ec95 Merged main:cf670d5e56d1 into amd-gfx:917468d90022 Remote branch main 6eee238 [unittest] Add option to allow disabling sharding in unittest (llvm#67063)
2 parents 4d4ec95 + 6eee238 commit 010f535

File tree

20 files changed

+417
-102
lines changed

20 files changed

+417
-102
lines changed

lld/ELF/InputSection.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -435,10 +435,7 @@ void InputSection::copyRelocations(uint8_t *buf,
435435
continue;
436436
}
437437
SectionBase *section = d->section;
438-
if (!section->isLive()) {
439-
p->setSymbolAndType(0, 0, false);
440-
continue;
441-
}
438+
assert(section->isLive());
442439

443440
int64_t addend = rel.addend;
444441
const uint8_t *bufLoc = sec->content().begin() + rel.offset;

lldb/include/lldb/Symbol/CompilerType.h

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,7 @@ class CompilerType {
4242
///
4343
/// \see lldb_private::TypeSystemClang::GetType(clang::QualType)
4444
CompilerType(lldb::TypeSystemWP type_system,
45-
lldb::opaque_compiler_type_t type)
46-
: m_type_system(type_system), m_type(type) {
47-
assert(Verify() && "verification failed");
48-
}
45+
lldb::opaque_compiler_type_t type);
4946

5047
/// This is a minimal wrapper of a TypeSystem shared pointer as
5148
/// returned by CompilerType which conventien dyn_cast support.
@@ -88,10 +85,8 @@ class CompilerType {
8885
lldb::TypeSystemSP GetSharedPointer() const { return m_typesystem_sp; }
8986
};
9087

91-
CompilerType(TypeSystemSPWrapper type_system, lldb::opaque_compiler_type_t type)
92-
: m_type_system(type_system.GetSharedPointer()), m_type(type) {
93-
assert(Verify() && "verification failed");
94-
}
88+
CompilerType(TypeSystemSPWrapper type_system,
89+
lldb::opaque_compiler_type_t type);
9590

9691
CompilerType(const CompilerType &rhs)
9792
: m_type_system(rhs.m_type_system), m_type(rhs.m_type) {}

lldb/include/lldb/Utility/Scalar.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ class Scalar {
101101

102102
const char *GetTypeAsCString() const { return GetValueTypeAsCString(m_type); }
103103

104-
void GetValue(Stream *s, bool show_type) const;
104+
void GetValue(Stream &s, bool show_type) const;
105105

106106
bool IsValid() const { return (m_type >= e_int) && (m_type <= e_float); }
107107

lldb/source/Core/Value.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,9 @@ void Value::AppendBytes(const void *bytes, int len) {
9898
}
9999

100100
void Value::Dump(Stream *strm) {
101-
m_value.GetValue(strm, true);
101+
if (!strm)
102+
return;
103+
m_value.GetValue(*strm, true);
102104
strm->Printf(", value_type = %s, context = %p, context_type = %s",
103105
Value::GetValueTypeAsCString(m_value_type), m_context,
104106
Value::GetContextTypeAsCString(m_context_type));

lldb/source/Interpreter/CommandInterpreter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1773,7 +1773,7 @@ CommandInterpreter::PreprocessToken(std::string &expr_str) {
17731773

17741774
StreamString value_strm;
17751775
const bool show_type = false;
1776-
scalar.GetValue(&value_strm, show_type);
1776+
scalar.GetValue(value_strm, show_type);
17771777
size_t value_string_size = value_strm.GetSize();
17781778
if (value_string_size) {
17791779
expr_str = value_strm.GetData();

lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ class SymbolFileDWARFDebugMap;
6262
class SymbolFileDWARFDwo;
6363
class SymbolFileDWARFDwp;
6464

65-
#define DIE_IS_BEING_PARSED ((Type *)1)
65+
#define DIE_IS_BEING_PARSED ((lldb_private::Type *)1)
6666

6767
class SymbolFileDWARF : public SymbolFileCommon {
6868
/// LLVM RTTI support.

lldb/source/Symbol/CompilerType.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -951,6 +951,18 @@ bool CompilerType::GetValueAsScalar(const lldb_private::DataExtractor &data,
951951
return false;
952952
}
953953

954+
CompilerType::CompilerType(CompilerType::TypeSystemSPWrapper type_system,
955+
lldb::opaque_compiler_type_t type)
956+
: m_type_system(type_system.GetSharedPointer()), m_type(type) {
957+
assert(Verify() && "verification failed");
958+
}
959+
960+
CompilerType::CompilerType(lldb::TypeSystemWP type_system,
961+
lldb::opaque_compiler_type_t type)
962+
: m_type_system(type_system), m_type(type) {
963+
assert(Verify() && "verification failed");
964+
}
965+
954966
#ifndef NDEBUG
955967
bool CompilerType::Verify() const {
956968
if (!IsValid())

lldb/source/Utility/Scalar.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -153,20 +153,20 @@ bool Scalar::IsZero() const {
153153
return false;
154154
}
155155

156-
void Scalar::GetValue(Stream *s, bool show_type) const {
156+
void Scalar::GetValue(Stream &s, bool show_type) const {
157157
if (show_type)
158-
s->Printf("(%s) ", GetTypeAsCString());
158+
s.Printf("(%s) ", GetTypeAsCString());
159159

160160
switch (m_type) {
161161
case e_void:
162162
break;
163163
case e_int:
164-
s->PutCString(llvm::toString(m_integer, 10));
164+
s.PutCString(llvm::toString(m_integer, 10));
165165
break;
166166
case e_float:
167167
llvm::SmallString<24> string;
168168
m_float.toString(string);
169-
s->PutCString(string);
169+
s.PutCString(string);
170170
break;
171171
}
172172
}
@@ -894,6 +894,6 @@ bool Scalar::SetBit(uint32_t bit) {
894894

895895
llvm::raw_ostream &lldb_private::operator<<(llvm::raw_ostream &os, const Scalar &scalar) {
896896
StreamString s;
897-
scalar.GetValue(&s, /*show_type*/ true);
897+
scalar.GetValue(s, /*show_type*/ true);
898898
return os << s.GetString();
899899
}

lldb/unittests/Utility/ScalarTest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ TEST(ScalarTest, ExtractBitfield) {
241241

242242
template <typename T> static std::string ScalarGetValue(T value) {
243243
StreamString stream;
244-
Scalar(value).GetValue(&stream, false);
244+
Scalar(value).GetValue(stream, false);
245245
return std::string(stream.GetString());
246246
}
247247

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 477818
19+
#define LLVM_MAIN_REVISION 477827
2020

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

llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp

Lines changed: 45 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -9036,41 +9036,45 @@ BoUpSLP::isGatherShuffledEntry(const TreeEntry *TE, ArrayRef<Value *> VL,
90369036
"Expected only single user of the gather node.");
90379037
// TODO: currently checking only for Scalars in the tree entry, need to count
90389038
// reused elements too for better cost estimation.
9039-
Instruction &UserInst =
9040-
getLastInstructionInBundle(TE->UserTreeIndices.front().UserTE);
9041-
BasicBlock *ParentBB = nullptr;
9039+
const EdgeInfo &TEUseEI = TE->UserTreeIndices.front();
9040+
const Instruction *TEInsertPt = &getLastInstructionInBundle(TEUseEI.UserTE);
9041+
const BasicBlock *TEInsertBlock = nullptr;
90429042
// Main node of PHI entries keeps the correct order of operands/incoming
90439043
// blocks.
9044-
if (auto *PHI =
9045-
dyn_cast<PHINode>(TE->UserTreeIndices.front().UserTE->getMainOp())) {
9046-
ParentBB = PHI->getIncomingBlock(TE->UserTreeIndices.front().EdgeIdx);
9044+
if (auto *PHI = dyn_cast<PHINode>(TEUseEI.UserTE->getMainOp())) {
9045+
TEInsertBlock = PHI->getIncomingBlock(TEUseEI.EdgeIdx);
90479046
} else {
9048-
ParentBB = UserInst.getParent();
9047+
TEInsertBlock = TEInsertPt->getParent();
90499048
}
9050-
auto *NodeUI = DT->getNode(ParentBB);
9049+
auto *NodeUI = DT->getNode(TEInsertBlock);
90519050
assert(NodeUI && "Should only process reachable instructions");
90529051
SmallPtrSet<Value *, 4> GatheredScalars(VL.begin(), VL.end());
9053-
auto CheckOrdering = [&](Instruction *LastEI) {
9054-
// Check if the user node of the TE comes after user node of EntryPtr,
9055-
// otherwise EntryPtr depends on TE.
9056-
// Gather nodes usually are not scheduled and inserted before their first
9057-
// user node. So, instead of checking dependency between the gather nodes
9058-
// themselves, we check the dependency between their user nodes.
9059-
// If one user node comes before the second one, we cannot use the second
9060-
// gather node as the source vector for the first gather node, because in
9061-
// the list of instructions it will be emitted later.
9062-
auto *EntryParent = LastEI->getParent();
9063-
auto *NodeEUI = DT->getNode(EntryParent);
9052+
auto CheckOrdering = [&](const Instruction *InsertPt) {
9053+
// Argument InsertPt is an instruction where vector code for some other
9054+
// tree entry (one that shares one or more scalars with TE) is going to be
9055+
// generated. This lambda returns true if insertion point of vector code
9056+
// for the TE dominates that point (otherwise dependency is the other way
9057+
// around). The other node is not limited to be of a gather kind. Gather
9058+
// nodes are not scheduled and their vector code is inserted before their
9059+
// first user. If user is PHI, that is supposed to be at the end of a
9060+
// predecessor block. Otherwise it is the last instruction among scalars of
9061+
// the user node. So, instead of checking dependency between instructions
9062+
// themselves, we check dependency between their insertion points for vector
9063+
// code (since each scalar instruction ends up as a lane of a vector
9064+
// instruction).
9065+
const BasicBlock *InsertBlock = InsertPt->getParent();
9066+
auto *NodeEUI = DT->getNode(InsertBlock);
90649067
if (!NodeEUI)
90659068
return false;
90669069
assert((NodeUI == NodeEUI) ==
90679070
(NodeUI->getDFSNumIn() == NodeEUI->getDFSNumIn()) &&
90689071
"Different nodes should have different DFS numbers");
90699072
// Check the order of the gather nodes users.
9070-
if (UserInst.getParent() != EntryParent &&
9073+
if (TEInsertPt->getParent() != InsertBlock &&
90719074
(DT->dominates(NodeUI, NodeEUI) || !DT->dominates(NodeEUI, NodeUI)))
90729075
return false;
9073-
if (UserInst.getParent() == EntryParent && UserInst.comesBefore(LastEI))
9076+
if (TEInsertPt->getParent() == InsertBlock &&
9077+
TEInsertPt->comesBefore(InsertPt))
90749078
return false;
90759079
return true;
90769080
};
@@ -9095,49 +9099,35 @@ BoUpSLP::isGatherShuffledEntry(const TreeEntry *TE, ArrayRef<Value *> VL,
90959099
[&](Value *V) { return GatheredScalars.contains(V); }) &&
90969100
"Must contain at least single gathered value.");
90979101
assert(TEPtr->UserTreeIndices.size() == 1 &&
9098-
"Expected only single user of the gather node.");
9099-
PHINode *EntryPHI =
9100-
dyn_cast<PHINode>(TEPtr->UserTreeIndices.front().UserTE->getMainOp());
9101-
Instruction *EntryUserInst =
9102-
EntryPHI ? nullptr
9103-
: &getLastInstructionInBundle(
9104-
TEPtr->UserTreeIndices.front().UserTE);
9105-
if (&UserInst == EntryUserInst) {
9106-
assert(!EntryPHI && "Unexpected phi node entry.");
9107-
// If 2 gathers are operands of the same entry, compare operands
9108-
// indices, use the earlier one as the base.
9109-
if (TE->UserTreeIndices.front().UserTE ==
9110-
TEPtr->UserTreeIndices.front().UserTE &&
9111-
TE->UserTreeIndices.front().EdgeIdx <
9112-
TEPtr->UserTreeIndices.front().EdgeIdx)
9102+
"Expected only single user of a gather node.");
9103+
const EdgeInfo &UseEI = TEPtr->UserTreeIndices.front();
9104+
9105+
PHINode *UserPHI = dyn_cast<PHINode>(UseEI.UserTE->getMainOp());
9106+
const Instruction *InsertPt =
9107+
UserPHI ? UserPHI->getIncomingBlock(UseEI.EdgeIdx)->getTerminator()
9108+
: &getLastInstructionInBundle(UseEI.UserTE);
9109+
if (!UserPHI && TEInsertPt == InsertPt) {
9110+
// If 2 gathers are operands of the same non-PHI entry,
9111+
// compare operands indices, use the earlier one as the base.
9112+
if (TEUseEI.UserTE == UseEI.UserTE && TEUseEI.EdgeIdx < UseEI.EdgeIdx)
91139113
continue;
91149114
// If the user instruction is used for some reason in different
91159115
// vectorized nodes - make it depend on index.
9116-
if (TE->UserTreeIndices.front().UserTE !=
9117-
TEPtr->UserTreeIndices.front().UserTE &&
9118-
TE->Idx < TEPtr->Idx)
9116+
if (TEUseEI.UserTE != UseEI.UserTE && TE->Idx < TEPtr->Idx)
91199117
continue;
91209118
}
9121-
// Check if the user node of the TE comes after user node of EntryPtr,
9122-
// otherwise EntryPtr depends on TE.
9123-
auto *EntryI =
9124-
EntryPHI
9125-
? EntryPHI
9126-
->getIncomingBlock(TEPtr->UserTreeIndices.front().EdgeIdx)
9127-
->getTerminator()
9128-
: EntryUserInst;
9129-
if ((ParentBB != EntryI->getParent() ||
9130-
TE->UserTreeIndices.front().EdgeIdx <
9131-
TEPtr->UserTreeIndices.front().EdgeIdx ||
9132-
TE->UserTreeIndices.front().UserTE !=
9133-
TEPtr->UserTreeIndices.front().UserTE) &&
9134-
!CheckOrdering(EntryI))
9119+
9120+
// Check if the user node of the TE comes after user node of TEPtr,
9121+
// otherwise TEPtr depends on TE.
9122+
if ((TEInsertBlock != InsertPt->getParent() ||
9123+
TEUseEI.EdgeIdx < UseEI.EdgeIdx || TEUseEI.UserTE != UseEI.UserTE) &&
9124+
!CheckOrdering(InsertPt))
91359125
continue;
91369126
VToTEs.insert(TEPtr);
91379127
}
91389128
if (const TreeEntry *VTE = getTreeEntry(V)) {
9139-
Instruction &EntryUserInst = getLastInstructionInBundle(VTE);
9140-
if (&EntryUserInst == &UserInst || !CheckOrdering(&EntryUserInst))
9129+
Instruction &LastBundleInst = getLastInstructionInBundle(VTE);
9130+
if (&LastBundleInst == TEInsertPt || !CheckOrdering(&LastBundleInst))
91419131
continue;
91429132
VToTEs.insert(VTE);
91439133
}

0 commit comments

Comments
 (0)