JIT: Allow RBO for known relops even without a dominator (#86774)
authorJakob Botsch Nielsen <Jakob.botsch.nielsen@gmail.com>
Fri, 26 May 2023 19:12:09 +0000 (21:12 +0200)
committerGitHub <noreply@github.com>
Fri, 26 May 2023 19:12:09 +0000 (21:12 +0200)
Delay the check for whether there is a dominator to the case where we're
actually going to try to infer from it.

src/coreclr/jit/redundantbranchopts.cpp

index dcbf9a1..9f5f2a6 100644 (file)
@@ -459,11 +459,6 @@ bool Compiler::optRedundantBranch(BasicBlock* const block)
     unsigned       matchCount  = 0;
     const unsigned matchLimit  = 4;
 
-    if (domBlock == nullptr)
-    {
-        return false;
-    }
-
     // Unpack the tree's VN
     //
     ValueNum treeNormVN;
@@ -482,6 +477,11 @@ bool Compiler::optRedundantBranch(BasicBlock* const block)
     }
     else
     {
+        if (domBlock == nullptr)
+        {
+            return false;
+        }
+
         JITDUMP("Relop [%06u] " FMT_BB " value unknown, trying inference\n", dspTreeID(tree), block->bbNum);
     }