1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 04:02:41 +01:00

Reapply "[DebugInfo] Prevent non-determinism when updating DIArgList users of a value"

Reapply the commit which previously caused build failures due to the
mismatched template arguments between the return type and the returned
SmallVector.

This reverts commit e8991caea8690ec2d17b0b7e1c29bf0da6609076.
This commit is contained in:
Stephen Tozer 2021-06-17 15:21:10 +01:00
parent abe1b0a2fe
commit 84970078e4
2 changed files with 11 additions and 5 deletions

View File

@ -304,7 +304,7 @@ public:
void replaceAllUsesWith(Metadata *MD);
/// Returns the list of all DIArgList users of this.
SmallVector<Metadata *, 4> getAllArgListUsers();
SmallVector<Metadata *> getAllArgListUsers();
/// Resolve all uses of this.
///
@ -385,7 +385,7 @@ public:
Type *getType() const { return V->getType(); }
LLVMContext &getContext() const { return V->getContext(); }
SmallVector<Metadata *, 4> getAllArgListUsers() {
SmallVector<Metadata *> getAllArgListUsers() {
return ReplaceableMetadataImpl::getAllArgListUsers();
}

View File

@ -195,16 +195,22 @@ bool MetadataTracking::isReplaceable(const Metadata &MD) {
return ReplaceableMetadataImpl::isReplaceable(MD);
}
SmallVector<Metadata *, 4> ReplaceableMetadataImpl::getAllArgListUsers() {
SmallVector<Metadata *, 4> MDUsers;
SmallVector<Metadata *> ReplaceableMetadataImpl::getAllArgListUsers() {
SmallVector<std::pair<OwnerTy, uint64_t> *> MDUsersWithID;
for (auto Pair : UseMap) {
OwnerTy Owner = Pair.second.first;
if (!Owner.is<Metadata *>())
continue;
Metadata *OwnerMD = Owner.get<Metadata *>();
if (OwnerMD->getMetadataID() == Metadata::DIArgListKind)
MDUsers.push_back(OwnerMD);
MDUsersWithID.push_back(&UseMap[Pair.first]);
}
llvm::sort(MDUsersWithID, [](auto UserA, auto UserB) {
return UserA->second < UserB->second;
});
SmallVector<Metadata *> MDUsers;
for (auto UserWithID : MDUsersWithID)
MDUsers.push_back(UserWithID->first.get<Metadata *>());
return MDUsers;
}