JIT: enable profile repairs of OSR entry block weight is zero (#86011)
authorAndy Ayers <andya@microsoft.com>
Tue, 9 May 2023 23:02:55 +0000 (16:02 -0700)
committerGitHub <noreply@github.com>
Tue, 9 May 2023 23:02:55 +0000 (16:02 -0700)
If the PGO solver finds the OSR entry block weight is zero, schedule the
method for profile repairs (similar to what we do for normal methods when
the method entry block weight is zero, see #84312).

Fixes #85838.

src/coreclr/jit/fgprofile.cpp

index a3a467a..63e5b7e 100644 (file)
@@ -3627,7 +3627,7 @@ void EfficientEdgeCountReconstructor::Propagate()
 //    for the OSR entry block.
 //
 // Arguments:
-//    block - block in question
+//    block - block in question (OSR entry)
 //    info - model info for the block
 //    nSucc - number of successors of the block in the flow graph
 //
@@ -3666,7 +3666,13 @@ void EfficientEdgeCountReconstructor::PropagateOSREntryEdges(BasicBlock* block,
     }
 
     assert(nEdges == nSucc);
-    assert(info->m_weight > BB_ZERO_WEIGHT);
+
+    if (info->m_weight == BB_ZERO_WEIGHT)
+    {
+        JITDUMP("\nPropagate: OSR entry block weight is zero\n");
+        EntryWeightZero();
+        return;
+    }
 
     // Transfer model edge weight onto the FlowEdges as likelihoods.
     //