File tree Expand file tree Collapse file tree 2 files changed +11
-5
lines changed Expand file tree Collapse file tree 2 files changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -304,7 +304,7 @@ class ReplaceableMetadataImpl {
304
304
void replaceAllUsesWith (Metadata *MD);
305
305
306
306
// / Returns the list of all DIArgList users of this.
307
- SmallVector<Metadata *, 4 > getAllArgListUsers ();
307
+ SmallVector<Metadata *> getAllArgListUsers ();
308
308
309
309
// / Resolve all uses of this.
310
310
// /
@@ -385,7 +385,7 @@ class ValueAsMetadata : public Metadata, ReplaceableMetadataImpl {
385
385
Type *getType () const { return V->getType (); }
386
386
LLVMContext &getContext () const { return V->getContext (); }
387
387
388
- SmallVector<Metadata *, 4 > getAllArgListUsers () {
388
+ SmallVector<Metadata *> getAllArgListUsers () {
389
389
return ReplaceableMetadataImpl::getAllArgListUsers ();
390
390
}
391
391
Original file line number Diff line number Diff line change @@ -195,16 +195,22 @@ bool MetadataTracking::isReplaceable(const Metadata &MD) {
195
195
return ReplaceableMetadataImpl::isReplaceable (MD);
196
196
}
197
197
198
- SmallVector<Metadata *, 4 > ReplaceableMetadataImpl::getAllArgListUsers () {
199
- SmallVector<Metadata *, 4 > MDUsers ;
198
+ SmallVector<Metadata *> ReplaceableMetadataImpl::getAllArgListUsers () {
199
+ SmallVector<std::pair<OwnerTy, uint64_t > *> MDUsersWithID ;
200
200
for (auto Pair : UseMap) {
201
201
OwnerTy Owner = Pair.second .first ;
202
202
if (!Owner.is <Metadata *>())
203
203
continue ;
204
204
Metadata *OwnerMD = Owner.get <Metadata *>();
205
205
if (OwnerMD->getMetadataID () == Metadata::DIArgListKind)
206
- MDUsers .push_back (OwnerMD );
206
+ MDUsersWithID .push_back (&UseMap[Pair. first ] );
207
207
}
208
+ llvm::sort (MDUsersWithID, [](auto UserA, auto UserB) {
209
+ return UserA->second < UserB->second ;
210
+ });
211
+ SmallVector<Metadata *> MDUsers;
212
+ for (auto UserWithID : MDUsersWithID)
213
+ MDUsers.push_back (UserWithID->first .get <Metadata *>());
208
214
return MDUsers;
209
215
}
210
216
You can’t perform that action at this time.
0 commit comments