This patch fixes the most recent issue mentioned in the discussion for patch D91722, in which some builds had non-deterministic output. This bug is rooted in ReplaceableMetadataImpl::getAllArgListUsers, which returns a vector of Metadata*; this vector is built by iterating over a map, and the result is later used to modify/produce instructions. This patch uses the IDs associated with each user to ensure that the vector is deterministically ordered; there is no importance to the ordering itself, other than that it is deterministic.
Details
Details
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Comment Actions
Thanks for finding this, I think it looks good.
llvm/lib/IR/Metadata.cpp | ||
---|---|---|
199 | 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. |
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.