From 6e6ae6003e703f4ead5f2140303c93ccd4195f23 Mon Sep 17 00:00:00 2001 From: "Aman Khalid (from Dev Box)" Date: Sun, 6 Apr 2025 16:38:49 -0400 Subject: [PATCH] Skip rarely-run block expansion during control flow opts --- src/coreclr/jit/optimizer.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/coreclr/jit/optimizer.cpp b/src/coreclr/jit/optimizer.cpp index 10abc319b6184f..b96988cf086d71 100644 --- a/src/coreclr/jit/optimizer.cpp +++ b/src/coreclr/jit/optimizer.cpp @@ -2379,11 +2379,11 @@ PhaseStatus Compiler::optOptimizeFlow() bool modified = fgUpdateFlowGraph(/* doTailDuplication */ true); - // Skipping fgExpandRarelyRunBlocks when we have PGO data incurs diffs if the profile is inconsistent, - // as it will propagate missing profile weights throughout the flowgraph. - // Running profile synthesis beforehand should get rid of these diffs. // TODO: Always rely on profile synthesis to identify cold blocks. - modified |= fgExpandRarelyRunBlocks(); + if (!fgIsUsingProfileWeights()) + { + modified |= fgExpandRarelyRunBlocks(); + } // Run branch optimizations for non-handler blocks. assert(!fgFuncletsCreated);