[llvm] [SPIR-V] Fix block sorting with irreducible CFG (PR #116996)

Vyacheslav Levytskyy via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 20 10:41:33 PST 2024


================
@@ -525,6 +525,12 @@ size_t PartialOrderingVisitor::GetNodeRank(BasicBlock *BB) const {
       continue;
 
     auto Iterator = BlockToOrder.end();
+    // This block hasn't been ranked yet. Ignoring.
+    // This doesn't happen often, but when dealing with irreducible CFG, we have
+    // to rank nodes without knowing the rank of all their predecessors.
+    if (Iterator == BlockToOrder.end())
----------------
VyacheslavLevytskyy wrote:

I don't understand how line 527 and 531 work together.

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


More information about the llvm-commits mailing list