Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/coreclr/jit/compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4825,10 +4825,6 @@ void Compiler::compCompile(void** methodCodePtr, uint32_t* methodCodeSize, JitFl
//
DoPhase(this, PHASE_COMPUTE_BLOCK_WEIGHTS, &Compiler::fgComputeBlockWeights);

// Invert loops
//
DoPhase(this, PHASE_INVERT_LOOPS, &Compiler::optInvertLoops);

// Run some flow graph optimizations (but don't reorder)
//
DoPhase(this, PHASE_OPTIMIZE_FLOW, &Compiler::optOptimizeFlow);
Expand All @@ -4852,6 +4848,10 @@ void Compiler::compCompile(void** methodCodePtr, uint32_t* methodCodeSize, JitFl
//
DoPhase(this, PHASE_SET_BLOCK_WEIGHTS, &Compiler::optSetBlockWeights);

// Invert loops
//
DoPhase(this, PHASE_INVERT_LOOPS, &Compiler::optInvertLoops);

// Clone loops with optimization opportunities, and choose one based on dynamic condition evaluation.
//
DoPhase(this, PHASE_CLONE_LOOPS, &Compiler::optCloneLoops);
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/jit/compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -7196,7 +7196,7 @@ class Compiler

OptInvertCountTreeInfoType optInvertCountTreeInfo(GenTree* tree);

bool optInvertWhileLoop(BasicBlock* block);
bool optTryInvertWhileLoop(FlowGraphNaturalLoop* loop);
bool optIfConvert(BasicBlock* block);

private:
Expand Down
7 changes: 6 additions & 1 deletion src/coreclr/jit/fgdiagnostic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4708,7 +4708,12 @@ void Compiler::fgDebugCheckLoops()
loop->VisitRegularExitBlocks([=](BasicBlock* exit) {
for (BasicBlock* pred : exit->PredBlocks())
{
assert(loop->ContainsBlock(pred));
if (!loop->ContainsBlock(pred))
{
JITDUMP("Loop " FMT_LP " exit " FMT_BB " has non-loop predecessor " FMT_BB "\n",
loop->GetIndex(), exit->bbNum, pred->bbNum);
assert(!"Loop exit has non-loop predecessor");
}
}
return BasicBlockVisit::Continue;
});
Expand Down
Loading