Skip to content
Merged
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
31 changes: 17 additions & 14 deletions src/coreclr/jit/optimizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5275,26 +5275,29 @@ PhaseStatus Compiler::optInvertLoops()
}
#endif // OPT_CONFIG

bool madeChanges = fgRenumberBlocks();

if (compCodeOpt() == SMALL_CODE)
{
return PhaseStatus::MODIFIED_NOTHING;
// do not invert any loops
}

bool madeChanges = false; // Assume no changes made
for (BasicBlock* const block : Blocks())
else
{
// Make sure the appropriate fields are initialized
//
if (block->bbWeight == BB_ZERO_WEIGHT)
for (BasicBlock* const block : Blocks())
{
// Zero weighted block can't have a LOOP_HEAD flag
noway_assert(block->isLoopHead() == false);
continue;
}
// Make sure the appropriate fields are initialized
//
if (block->bbWeight == BB_ZERO_WEIGHT)
{
// Zero weighted block can't have a LOOP_HEAD flag
noway_assert(block->isLoopHead() == false);
continue;
}

if (optInvertWhileLoop(block))
{
madeChanges = true;
if (optInvertWhileLoop(block))
{
madeChanges = true;
}
}
}

Expand Down