Skip to content

Commit 2ef654f

Browse files
amanasifkhalidmichaelgsharp
authored andcommitted
JIT: Remove HANDLER_ENTRY_MUST_BE_IN_HOT_SECTION (dotnet#101611)
1 parent d73a7df commit 2ef654f

File tree

5 files changed

+5
-62
lines changed

5 files changed

+5
-62
lines changed

src/coreclr/jit/block.h

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1256,27 +1256,6 @@ struct BasicBlock : private LIR::Range
12561256
this->scaleBBWeight(BB_ZERO_WEIGHT);
12571257
}
12581258

1259-
// makeBlockHot()
1260-
// This is used to override any profiling data
1261-
// and force a block to be in the hot region.
1262-
// We only call this method for handler entry point
1263-
// and only when HANDLER_ENTRY_MUST_BE_IN_HOT_SECTION is 1.
1264-
// Doing this helps fgReorderBlocks() by telling
1265-
// it to try to move these blocks into the hot region.
1266-
// Note that we do this strictly as an optimization,
1267-
// not for correctness. fgDetermineFirstColdBlock()
1268-
// will find all handler entry points and ensure that
1269-
// for now we don't place them in the cold section.
1270-
//
1271-
void makeBlockHot()
1272-
{
1273-
if (this->bbWeight == BB_ZERO_WEIGHT)
1274-
{
1275-
this->RemoveFlags(BBF_RUN_RARELY | BBF_PROF_WEIGHT);
1276-
this->bbWeight = 1;
1277-
}
1278-
}
1279-
12801259
bool isMaxBBWeight() const
12811260
{
12821261
return (bbWeight >= BB_MAX_WEIGHT);

src/coreclr/jit/fgehopt.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1229,16 +1229,6 @@ PhaseStatus Compiler::fgCloneFinally()
12291229
block->setBBProfileWeight(blockWeight * originalScale);
12301230
JITDUMP("Set weight of " FMT_BB " to " FMT_WT "\n", block->bbNum, block->bbWeight);
12311231

1232-
#if HANDLER_ENTRY_MUST_BE_IN_HOT_SECTION
1233-
// Handle a special case -- some handler entries can't have zero profile count.
1234-
//
1235-
if (bbIsHandlerBeg(block) && block->isRunRarely())
1236-
{
1237-
JITDUMP("Suppressing zero count for " FMT_BB " as it is a handler entry\n", block->bbNum);
1238-
block->makeBlockHot();
1239-
}
1240-
#endif
1241-
12421232
BasicBlock* const clonedBlock = blockMap[block];
12431233
clonedBlock->setBBProfileWeight(blockWeight * clonedScale);
12441234
JITDUMP("Set weight of " FMT_BB " to " FMT_WT "\n", clonedBlock->bbNum, clonedBlock->bbWeight);

src/coreclr/jit/fgprofile.cpp

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3018,21 +3018,10 @@ PhaseStatus Compiler::fgIncorporateProfileData()
30183018
//
30193019
// Notes:
30203020
// Does inlinee scaling.
3021-
// Handles handler entry special case.
30223021
//
30233022
void Compiler::fgSetProfileWeight(BasicBlock* block, weight_t profileWeight)
30243023
{
30253024
block->setBBProfileWeight(profileWeight);
3026-
3027-
#if HANDLER_ENTRY_MUST_BE_IN_HOT_SECTION
3028-
// Handle a special case -- some handler entries can't have zero profile count.
3029-
//
3030-
if (this->bbIsHandlerBeg(block) && block->isRunRarely())
3031-
{
3032-
JITDUMP("Suppressing zero count for " FMT_BB " as it is a handler entry\n", block->bbNum);
3033-
block->makeBlockHot();
3034-
}
3035-
#endif
30363025
}
30373026

30383027
//------------------------------------------------------------------------

src/coreclr/jit/flowgraph.cpp

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3083,17 +3083,12 @@ bool Compiler::fgFuncletsAreCold()
30833083
//
30843084
// Notes:
30853085
// Walk the basic blocks list to determine the first block to place in the
3086-
// cold section. This would be the first of a series of rarely executed blocks
3086+
// cold section. This would be the first of a series of rarely executed blocks
30873087
// such that no succeeding blocks are in a try region or an exception handler
30883088
// or are rarely executed.
30893089
//
30903090
PhaseStatus Compiler::fgDetermineFirstColdBlock()
30913091
{
3092-
// Since we may need to create a new transition block
3093-
// we assert that it is OK to create new blocks.
3094-
//
3095-
assert(fgPredsComputed);
3096-
assert(fgSafeBasicBlockCreation);
30973092
assert(fgFirstColdBlock == nullptr);
30983093

30993094
if (!opts.compProcedureSplitting)
@@ -3134,15 +3129,6 @@ PhaseStatus Compiler::fgDetermineFirstColdBlock()
31343129

31353130
for (lblk = nullptr, block = fgFirstBB; block != nullptr; lblk = block, block = block->Next())
31363131
{
3137-
bool blockMustBeInHotSection = false;
3138-
3139-
#if HANDLER_ENTRY_MUST_BE_IN_HOT_SECTION
3140-
if (bbIsHandlerBeg(block))
3141-
{
3142-
blockMustBeInHotSection = true;
3143-
}
3144-
#endif // HANDLER_ENTRY_MUST_BE_IN_HOT_SECTION
3145-
31463132
// Make note of if we're in the funclet section,
31473133
// so we can stop the search early.
31483134
if (block == fgFirstFuncletBB)
@@ -3156,7 +3142,7 @@ PhaseStatus Compiler::fgDetermineFirstColdBlock()
31563142
// We have a candidate for first cold block
31573143

31583144
// Is this a hot block?
3159-
if (blockMustBeInHotSection || (block->isRunRarely() == false))
3145+
if (!block->isRunRarely())
31603146
{
31613147
// We have to restart the search for the first cold block
31623148
firstColdBlock = nullptr;
@@ -3195,7 +3181,7 @@ PhaseStatus Compiler::fgDetermineFirstColdBlock()
31953181
}
31963182

31973183
// Is this a cold block?
3198-
if (!blockMustBeInHotSection && block->isRunRarely())
3184+
if (block->isRunRarely())
31993185
{
32003186
//
32013187
// If the last block that was hot was a BBJ_COND

src/coreclr/jit/jit.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -470,9 +470,8 @@ class GlobalJitOptions
470470

471471
/*****************************************************************************/
472472

473-
#define CSE_INTO_HANDLERS 0
474-
#define DUMP_FLOWGRAPHS DEBUG // Support for creating Xml Flowgraph reports in *.fgx files
475-
#define HANDLER_ENTRY_MUST_BE_IN_HOT_SECTION 0 // if 1 we must have all handler entry points in the Hot code section
473+
#define CSE_INTO_HANDLERS 0
474+
#define DUMP_FLOWGRAPHS DEBUG // Support for creating Xml Flowgraph reports in *.fgx files
476475

477476
/*****************************************************************************/
478477

0 commit comments

Comments
 (0)