Skip to content

Commit

Permalink
JIT: Port loop compaction to new loop representation (#96995)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jakobbotsch committed Jan 18, 2024
1 parent 77d643d commit 13ab6eb
Show file tree
Hide file tree
Showing 2 changed files with 316 additions and 525 deletions.
7 changes: 6 additions & 1 deletion src/coreclr/jit/compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -6814,7 +6814,12 @@ class Compiler

void optFindLoops();
void optFindNewLoops();
bool optCanonicalizeLoops(FlowGraphNaturalLoops* loops);
bool optCanonicalizeLoops();
bool optCompactLoops();
bool optCompactLoop(FlowGraphNaturalLoop* loop);
BasicBlock* optFindLoopCompactionInsertionPoint(FlowGraphNaturalLoop* loop, BasicBlock* top);
BasicBlock* optTryAdvanceLoopCompactionInsertionPoint(FlowGraphNaturalLoop* loop, BasicBlock* insertionPoint, BasicBlock* top, BasicBlock* bottom);
bool optLoopCompactionFixupFallThrough(BasicBlock* block, BasicBlock* oldNext, BasicBlock* newNext);
bool optCreatePreheader(FlowGraphNaturalLoop* loop);
void optSetPreheaderWeight(FlowGraphNaturalLoop* loop, BasicBlock* preheader);

Expand Down
Loading

0 comments on commit 13ab6eb

Please sign in to comment.