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

Nathan Gauër via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 20 10:55:10 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())
----------------
Keenuts wrote:

Thanks for catching my mistake! That code is quite embarrassing to look at 😅

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


More information about the llvm-commits mailing list