Skip to content

Commit 2c33bd9

Browse files
committed
Fix phase status of optOptimizeLayout
1 parent d4ccb56 commit 2c33bd9

File tree

3 files changed

+19
-18
lines changed

3 files changed

+19
-18
lines changed

src/coreclr/jit/compiler.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5383,7 +5383,7 @@ class Compiler
53835383
void fgComputeCalledCount(BasicBlock::weight_t returnWeight);
53845384
void fgComputeEdgeWeights();
53855385

5386-
void fgReorderBlocks();
5386+
bool fgReorderBlocks();
53875387

53885388
void fgDetermineFirstColdBlock();
53895389

src/coreclr/jit/fgopt.cpp

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3661,15 +3661,17 @@ bool Compiler::fgOptimizeSwitchJumps()
36613661
#pragma warning(push)
36623662
#pragma warning(disable : 21000) // Suppress PREFast warning about overly large function
36633663
#endif
3664-
/*****************************************************************************
3665-
*
3666-
* Function called to reorder the flowgraph of BasicBlocks such that any
3667-
* rarely run blocks are placed at the end of the block list.
3668-
* If we have profile information we also use that information to reverse
3669-
* all conditional jumps that would benefit.
3670-
*/
36713664

3672-
void Compiler::fgReorderBlocks()
3665+
//-----------------------------------------------------------------------------
3666+
// fgReorderBlocks: reorder blocks to favor frequent fall through paths,
3667+
// move rare blocks to the end of the method/eh region, and move
3668+
// funclets to the ends of methods.
3669+
//
3670+
// Returns:
3671+
// True if anything got reordered. Not reordering may involve modifying
3672+
// IR to reverse branch conditions.
3673+
//
3674+
bool Compiler::fgReorderBlocks()
36733675
{
36743676
noway_assert(opts.compDbgCode == false);
36753677

@@ -3680,7 +3682,7 @@ void Compiler::fgReorderBlocks()
36803682
// We can't relocate anything if we only have one block
36813683
if (fgFirstBB->bbNext == nullptr)
36823684
{
3683-
return;
3685+
return false;
36843686
}
36853687

36863688
bool newRarelyRun = false;
@@ -4816,7 +4818,7 @@ void Compiler::fgReorderBlocks()
48164818

48174819
} // end of for loop(bPrev,block)
48184820

4819-
bool changed = movedBlocks || newRarelyRun || optimizedSwitches;
4821+
const bool changed = movedBlocks || newRarelyRun || optimizedSwitches;
48204822

48214823
if (changed)
48224824
{
@@ -4829,6 +4831,8 @@ void Compiler::fgReorderBlocks()
48294831
}
48304832
#endif // DEBUG
48314833
}
4834+
4835+
return changed;
48324836
}
48334837
#ifdef _PREFAST_
48344838
#pragma warning(pop)

src/coreclr/jit/optimizer.cpp

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4511,18 +4511,15 @@ PhaseStatus Compiler::optOptimizeLayout()
45114511
const bool allowTailDuplication = true;
45124512

45134513
madeChanges |= fgUpdateFlowGraph(allowTailDuplication);
4514-
fgReorderBlocks();
4515-
madeChanges |= fgModified;
4514+
madeChanges |= fgReorderBlocks();
45164515
madeChanges |= fgUpdateFlowGraph();
45174516

45184517
return madeChanges ? PhaseStatus::MODIFIED_EVERYTHING : PhaseStatus::MODIFIED_NOTHING;
45194518
}
45204519

4521-
/*****************************************************************************
4522-
*
4523-
* Perform loop inversion, find and classify natural loops
4524-
*/
4525-
4520+
//-----------------------------------------------------------------------------
4521+
// optOptimizeLoops: find and classify natural loops
4522+
//
45264523
void Compiler::optOptimizeLoops()
45274524
{
45284525
noway_assert(opts.OptimizationEnabled());

0 commit comments

Comments
 (0)