[PATCH] D104105: [DebugInfo] Prevent non-determinism when updating DIArgList users of a value

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 11 16:37:04 PDT 2021


rnk accepted this revision.
rnk added a comment.
This revision is now accepted and ready to land.

Thanks for finding this, I think it looks good.



================
Comment at: llvm/lib/IR/Metadata.cpp:199
 SmallVector<Metadata *, 4> ReplaceableMetadataImpl::getAllArgListUsers() {
-  SmallVector<Metadata *, 4> MDUsers;
+  SmallVector<std::pair<Metadata *, uint64_t>> MDUsersWithID;
   for (auto Pair : UseMap) {
----------------
This is a bit pedantic, but it seems like it could be less code to build a vector of pointers to pairs in the DenseMap, sort those pointers to pairs, and then extract the owners afterwards. Fewer new pairs with new implied meanings of .second, that sort of thing.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D104105/new/

https://reviews.llvm.org/D104105



More information about the llvm-commits mailing list