Skip to content

Commit e4d5707

Browse files
committed
Fix dotnet-pgo SPGO crash in FlowSmoothing.MakeGraphFeasible
FlowSmoothing.MakeGraphFeasible throws InvalidOperationException ("Stack empty") when a method's flow graph has a node with positive sample count that doesn't reach an exit node. This crashes the entire SPGO pass in SmoothAllProfiles, losing all attributed samples. Wrap SmoothFlow in a try-catch so one problematic method doesn't prevent SPGO data from being generated for all other methods. Observed when processing perfcollect .trace.zip with ~143K successfully attributed samples — all lost due to one bad method.
1 parent f416dc4 commit e4d5707

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/coreclr/tools/dotnet-pgo/SPGO/SampleCorrelator.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public SampleProfile GetProfile(MethodDesc md)
6666
public void SmoothAllProfiles()
6767
{
6868
foreach (PerMethodInfo pmi in _methodInf.Values)
69-
pmi.Profile.SmoothFlow();
69+
try { pmi.Profile.SmoothFlow(); } catch (Exception) { /* Skip methods with disconnected flow graphs */ }
7070
}
7171

7272
public void AttributeSamplesToIP(ulong ip, long numSamples)

0 commit comments

Comments
 (0)