Skip to content

Commit 13ab6eb

Browse files
authored
JIT: Port loop compaction to new loop representation (#96995)
Some diffs expected from (at least) three sources: - Less/different compaction in cases where new loop recognition recognizes fewer loops than old recognition - Less compaction in cases where compacting the first loop led to old loop recognition recognizing another loop after the first one. This leads to no `BBF_OLD_LOOP_HEADER_QUIRK` set on the second loop's header found by new loop finding, meaning we do not compact it. It will be compacted as part of a future PR that enables compaction for all loops. - Slight differences in compaction behavior for blocks that aren't part of the loop and that couldn't be moved, which would previously abort compaction and recognition of the loop. Now we just leave those blocks in place.
1 parent 77d643d commit 13ab6eb

File tree

2 files changed

+316
-525
lines changed

2 files changed

+316
-525
lines changed

src/coreclr/jit/compiler.h

+6-1
Original file line numberDiff line numberDiff line change
@@ -6814,7 +6814,12 @@ class Compiler
68146814

68156815
void optFindLoops();
68166816
void optFindNewLoops();
6817-
bool optCanonicalizeLoops(FlowGraphNaturalLoops* loops);
6817+
bool optCanonicalizeLoops();
6818+
bool optCompactLoops();
6819+
bool optCompactLoop(FlowGraphNaturalLoop* loop);
6820+
BasicBlock* optFindLoopCompactionInsertionPoint(FlowGraphNaturalLoop* loop, BasicBlock* top);
6821+
BasicBlock* optTryAdvanceLoopCompactionInsertionPoint(FlowGraphNaturalLoop* loop, BasicBlock* insertionPoint, BasicBlock* top, BasicBlock* bottom);
6822+
bool optLoopCompactionFixupFallThrough(BasicBlock* block, BasicBlock* oldNext, BasicBlock* newNext);
68186823
bool optCreatePreheader(FlowGraphNaturalLoop* loop);
68196824
void optSetPreheaderWeight(FlowGraphNaturalLoop* loop, BasicBlock* preheader);
68206825

0 commit comments

Comments
 (0)