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

Eli Friedman via llvm-commits llvm-commits at lists.llvm.org
Wed May 8 18:38:14 PDT 2024


================
@@ -766,6 +807,9 @@ unsigned GVNSink::sinkBB(BasicBlock *BBEnd) {
              BBEnd->printAsOperand(dbgs()); dbgs() << "\n");
   SmallVector<BasicBlock *, 4> Preds;
   for (auto *B : predecessors(BBEnd)) {
+    // Bailout on malformed CFG where BasicBlock has no predecessor(PR42346).
----------------
efriedma-quic wrote:

Malformed is an exaggeration; the IR verifier is perfectly fine with code like this.

Realistically, it'll almost always get cleaned up before this pass runs, so it doesn't really matter what you do here, but please use clear wording.

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


More information about the llvm-commits mailing list