[PATCH] D120670: [CSSPGO][SCCIterator] Fix a non-determinism in scc_member_iterator
Hongtao Yu via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 8 09:09:00 PST 2022
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG50bc945a8fc5: [CSSPGO][SCCIterator] Fix a non-determinism in scc_member_iterator (authored by hoy).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D120670/new/
https://reviews.llvm.org/D120670
Files:
llvm/include/llvm/ADT/SCCIterator.h
Index: llvm/include/llvm/ADT/SCCIterator.h
===================================================================
--- llvm/include/llvm/ADT/SCCIterator.h
+++ llvm/include/llvm/ADT/SCCIterator.h
@@ -348,9 +348,14 @@
NodeInfoMap[Edge->Target].Visited = false;
std::queue<NodeType *> Queue;
- for (auto &Node : NodeInfoMap)
- if (Node.second.Visited)
- Queue.push(Node.first);
+ // Initialze the queue with MST roots. Note that walking through SortedEdges
+ // instead of NodeInfoMap ensures an ordered deterministic push.
+ for (auto *Edge : SortedEdges) {
+ if (NodeInfoMap[Edge->Source].Visited) {
+ Queue.push(Edge->Source);
+ NodeInfoMap[Edge->Source].Visited = false;
+ }
+ }
while (!Queue.empty()) {
auto *Node = Queue.front();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D120670.413826.patch
Type: text/x-patch
Size: 778 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220308/e6e28755/attachment.bin>
More information about the llvm-commits
mailing list