Skip to content

Commit 93ebf52

Browse files
JIT: Replace fgMoveHotJumps with 3-opt utility (dotnet#112016)
Part of dotnet#107749. Based on the plans outlined in dotnet#111989 (comment), we want to remove phases that prematurely tweak the initial layout fed into 3-opt; fgMoveHotJumps is one such phase. However, initial attempts to remove it incurred large size increases on x86/x64, suggesting there was some utility in moving blocks closer to their hottest successors to keep the layout compact. To avoid derailing my consolidation plan, I've decided to refactor fgMoveHotJumps into a utility for 3-opt to use. For now, we will continue to use this pass to try to keep the layout compact. In the future, this functionality may be useful for churning the initial layout into 3-opt to discover new local-optimal layouts.
1 parent b606aa3 commit 93ebf52

File tree

2 files changed

+189
-235
lines changed

2 files changed

+189
-235
lines changed

src/coreclr/jit/compiler.h

+4-5
Original file line numberDiff line numberDiff line change
@@ -6371,24 +6371,23 @@ class Compiler
63716371
#endif // DEBUG
63726372

63736373
weight_t GetCost(BasicBlock* block, BasicBlock* next);
6374-
weight_t GetPartitionCostDelta(unsigned s1Start, unsigned s2Start, unsigned s3Start, unsigned s3End, unsigned s4End);
6374+
weight_t GetPartitionCostDelta(unsigned s2Start, unsigned s3Start, unsigned s3End, unsigned s4End);
63756375
void SwapPartitions(unsigned s1Start, unsigned s2Start, unsigned s3Start, unsigned s3End, unsigned s4End);
63766376

6377-
void ConsiderEdge(FlowEdge* edge);
6377+
template <bool addToQueue = true>
6378+
bool ConsiderEdge(FlowEdge* edge);
63786379
void AddNonFallthroughSuccs(unsigned blockPos);
63796380
void AddNonFallthroughPreds(unsigned blockPos);
63806381
bool RunGreedyThreeOptPass(unsigned startPos, unsigned endPos);
63816382

6383+
bool CompactHotJumps();
63826384
bool RunThreeOpt();
63836385

63846386
public:
63856387
ThreeOptLayout(Compiler* comp);
63866388
void Run();
63876389
};
63886390

6389-
template <bool hasEH>
6390-
void fgMoveHotJumps();
6391-
63926391
bool fgFuncletsAreCold();
63936392

63946393
PhaseStatus fgDetermineFirstColdBlock();

0 commit comments

Comments
 (0)