[llvm] [GVNSink] Fix non-determinisms by using a deterministic ordering (PR #90995)

Eli Friedman via llvm-commits llvm-commits at lists.llvm.org
Thu May 9 15:54:28 PDT 2024


================
@@ -607,13 +606,16 @@ class GVNSink {
     unsigned NumSunk = 0;
     ReversePostOrderTraversal<Function*> RPOT(&F);
     VN.setReachableBBs(BasicBlocksSet(RPOT.begin(), RPOT.end()));
-    // Populated DFSNumbers ahead of time to avoid updating dominator tree
-    // when CFG is modified. The DFSNumbers of newly created basic blocks
-    // are irrelevant because RPOT is also obtained ahead of time and only
-    // DFSNumbers of original CFG are relevant for sinkable candidates.
+    // Populate reverse post-order to order basic blocks in deterministic
+    // order. Any arbitray ordering will work in this case as long they are
----------------
efriedma-quic wrote:

```suggestion
    // order. Any arbitrary ordering will work in this case as long they are
```

https://github.com/llvm/llvm-project/pull/90995


More information about the llvm-commits mailing list