Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JIT: Remove BBF_FUNCLET_BEG #113975

Merged
merged 5 commits into from
Mar 31, 2025
Merged
Show file tree
Hide file tree
Changes from 2 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: 1 addition & 7 deletions src/coreclr/jit/block.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,6 @@ void BasicBlock::dspFlags() const
{BBF_HAS_CALL, "hascall"},
{BBF_DOMINATED_BY_EXCEPTIONAL_ENTRY, "xentry"},
{BBF_GC_SAFE_POINT, "gcsafe"},
{BBF_FUNCLET_BEG, "flet"},
{BBF_HAS_IDX_LEN, "idxlen"},
{BBF_HAS_MD_IDX_LEN, "mdidxlen"},
{BBF_HAS_NEWOBJ, "newobj"},
Expand Down Expand Up @@ -1742,12 +1741,7 @@ bool BasicBlock::isBBCallFinallyPairTail() const
//
bool BasicBlock::hasEHBoundaryIn() const
{
bool returnVal = (bbCatchTyp != BBCT_NONE);
if (!returnVal)
{
assert(!HasFlag(BBF_FUNCLET_BEG));
}
return returnVal;
return (bbCatchTyp != BBCT_NONE);
}

//------------------------------------------------------------------------
Expand Down
72 changes: 35 additions & 37 deletions src/coreclr/jit/block.h
Original file line number Diff line number Diff line change
Expand Up @@ -426,45 +426,43 @@ enum BasicBlockFlags : uint64_t
BBF_IMPORTED = MAKE_BBFLAG( 4), // BB byte-code has been imported
BBF_INTERNAL = MAKE_BBFLAG( 5), // BB has been added by the compiler
BBF_NEEDS_GCPOLL = MAKE_BBFLAG( 6), // BB may need a GC poll because it uses the slow tail call helper
BBF_FUNCLET_BEG = MAKE_BBFLAG( 7), // BB is the beginning of a funclet
BBF_CLONED_FINALLY_BEGIN = MAKE_BBFLAG( 8), // First block of a cloned finally region
BBF_CLONED_FINALLY_END = MAKE_BBFLAG( 9), // Last block of a cloned finally region
BBF_HAS_NULLCHECK = MAKE_BBFLAG(10), // BB contains a null check
BBF_HAS_SUPPRESSGC_CALL = MAKE_BBFLAG(11), // BB contains a call to a method with SuppressGCTransitionAttribute
BBF_RUN_RARELY = MAKE_BBFLAG(12), // BB is rarely run (catch clauses, blocks with throws etc)
BBF_LOOP_HEAD = MAKE_BBFLAG(13), // BB is the head of a loop (can reach a predecessor)
BBF_HAS_LABEL = MAKE_BBFLAG(14), // BB needs a label
BBF_LOOP_ALIGN = MAKE_BBFLAG(15), // Block is lexically the first block in a loop we intend to align.
BBF_HAS_ALIGN = MAKE_BBFLAG(16), // BB ends with 'align' instruction
BBF_HAS_JMP = MAKE_BBFLAG(17), // BB executes a JMP instruction (instead of return)
BBF_GC_SAFE_POINT = MAKE_BBFLAG(18), // BB has a GC safe point (e.g. a call)
BBF_HAS_IDX_LEN = MAKE_BBFLAG(19), // BB contains simple index or length expressions on an SD array local var.
BBF_HAS_MD_IDX_LEN = MAKE_BBFLAG(20), // BB contains simple index, length, or lower bound expressions on an MD array local var.
BBF_HAS_MDARRAYREF = MAKE_BBFLAG(21), // Block has a multi-dimensional array reference
BBF_HAS_NEWOBJ = MAKE_BBFLAG(22), // BB contains 'new' of an object type.

BBF_RETLESS_CALL = MAKE_BBFLAG(23), // BBJ_CALLFINALLY that will never return (and therefore, won't need a paired
BBF_CLONED_FINALLY_BEGIN = MAKE_BBFLAG( 7), // First block of a cloned finally region
BBF_CLONED_FINALLY_END = MAKE_BBFLAG( 8), // Last block of a cloned finally region
BBF_HAS_NULLCHECK = MAKE_BBFLAG( 9), // BB contains a null check
BBF_HAS_SUPPRESSGC_CALL = MAKE_BBFLAG(10), // BB contains a call to a method with SuppressGCTransitionAttribute
BBF_RUN_RARELY = MAKE_BBFLAG(11), // BB is rarely run (catch clauses, blocks with throws etc)
BBF_LOOP_HEAD = MAKE_BBFLAG(12), // BB is the head of a loop (can reach a predecessor)
BBF_HAS_LABEL = MAKE_BBFLAG(13), // BB needs a label
BBF_LOOP_ALIGN = MAKE_BBFLAG(14), // Block is lexically the first block in a loop we intend to align.
BBF_HAS_ALIGN = MAKE_BBFLAG(15), // BB ends with 'align' instruction
BBF_HAS_JMP = MAKE_BBFLAG(16), // BB executes a JMP instruction (instead of return)
BBF_GC_SAFE_POINT = MAKE_BBFLAG(17), // BB has a GC safe point (e.g. a call)
BBF_HAS_IDX_LEN = MAKE_BBFLAG(18), // BB contains simple index or length expressions on an SD array local var.
BBF_HAS_MD_IDX_LEN = MAKE_BBFLAG(19), // BB contains simple index, length, or lower bound expressions on an MD array local var.
BBF_HAS_MDARRAYREF = MAKE_BBFLAG(20), // Block has a multi-dimensional array reference
BBF_HAS_NEWOBJ = MAKE_BBFLAG(21), // BB contains 'new' of an object type.

BBF_RETLESS_CALL = MAKE_BBFLAG(22), // BBJ_CALLFINALLY that will never return (and therefore, won't need a paired
// BBJ_CALLFINALLYRET); see isBBCallFinallyPair().
BBF_COLD = MAKE_BBFLAG(24), // BB is cold
BBF_PROF_WEIGHT = MAKE_BBFLAG(25), // BB weight is computed from profile data
BBF_KEEP_BBJ_ALWAYS = MAKE_BBFLAG(26), // A special BBJ_ALWAYS block, used by EH code generation. Keep the jump kind
BBF_COLD = MAKE_BBFLAG(23), // BB is cold
BBF_PROF_WEIGHT = MAKE_BBFLAG(24), // BB weight is computed from profile data
BBF_KEEP_BBJ_ALWAYS = MAKE_BBFLAG(25), // A special BBJ_ALWAYS block, used by EH code generation. Keep the jump kind
// as BBJ_ALWAYS. Used on x86 for the final step block out of a finally.
BBF_HAS_CALL = MAKE_BBFLAG(27), // BB contains a call
BBF_DOMINATED_BY_EXCEPTIONAL_ENTRY = MAKE_BBFLAG(28), // Block is dominated by exceptional entry.
BBF_BACKWARD_JUMP = MAKE_BBFLAG(29), // BB is surrounded by a backward jump/switch arc
BBF_BACKWARD_JUMP_SOURCE = MAKE_BBFLAG(30), // Block is a source of a backward jump
BBF_BACKWARD_JUMP_TARGET = MAKE_BBFLAG(31), // Block is a target of a backward jump
BBF_PATCHPOINT = MAKE_BBFLAG(32), // Block is a patchpoint
BBF_PARTIAL_COMPILATION_PATCHPOINT = MAKE_BBFLAG(33), // Block is a partial compilation patchpoint
BBF_HAS_HISTOGRAM_PROFILE = MAKE_BBFLAG(34), // BB contains a call needing a histogram profile
BBF_TAILCALL_SUCCESSOR = MAKE_BBFLAG(35), // BB has pred that has potential tail call
BBF_RECURSIVE_TAILCALL = MAKE_BBFLAG(36), // Block has recursive tailcall that may turn into a loop
BBF_NO_CSE_IN = MAKE_BBFLAG(37), // Block should kill off any incoming CSE
BBF_CAN_ADD_PRED = MAKE_BBFLAG(38), // Ok to add pred edge to this block, even when "safe" edge creation disabled
BBF_HAS_VALUE_PROFILE = MAKE_BBFLAG(39), // Block has a node that needs a value probing

BBF_HAS_NEWARR = MAKE_BBFLAG(40), // BB contains 'new' of an array type.
BBF_MAY_HAVE_BOUNDS_CHECKS = MAKE_BBFLAG(41), // BB *likely* has a bounds check (after rangecheck phase).
BBF_HAS_CALL = MAKE_BBFLAG(26), // BB contains a call
BBF_DOMINATED_BY_EXCEPTIONAL_ENTRY = MAKE_BBFLAG(27), // Block is dominated by exceptional entry.
BBF_BACKWARD_JUMP = MAKE_BBFLAG(28), // BB is surrounded by a backward jump/switch arc
BBF_BACKWARD_JUMP_SOURCE = MAKE_BBFLAG(29), // Block is a source of a backward jump
BBF_BACKWARD_JUMP_TARGET = MAKE_BBFLAG(30), // Block is a target of a backward jump
BBF_PATCHPOINT = MAKE_BBFLAG(31), // Block is a patchpoint
BBF_PARTIAL_COMPILATION_PATCHPOINT = MAKE_BBFLAG(32), // Block is a partial compilation patchpoint
BBF_HAS_HISTOGRAM_PROFILE = MAKE_BBFLAG(33), // BB contains a call needing a histogram profile
BBF_TAILCALL_SUCCESSOR = MAKE_BBFLAG(34), // BB has pred that has potential tail call
BBF_RECURSIVE_TAILCALL = MAKE_BBFLAG(35), // Block has recursive tailcall that may turn into a loop
BBF_NO_CSE_IN = MAKE_BBFLAG(36), // Block should kill off any incoming CSE
BBF_CAN_ADD_PRED = MAKE_BBFLAG(37), // Ok to add pred edge to this block, even when "safe" edge creation disabled
BBF_HAS_VALUE_PROFILE = MAKE_BBFLAG(38), // Block has a node that needs a value probing
BBF_HAS_NEWARR = MAKE_BBFLAG(39), // BB contains 'new' of an array type.
BBF_MAY_HAVE_BOUNDS_CHECKS = MAKE_BBFLAG(40), // BB *likely* has a bounds check (after rangecheck phase).

// The following are sets of flags.

Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/jit/codegenarm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2325,7 +2325,7 @@ void CodeGen::genFuncletProlog(BasicBlock* block)
#endif

assert(block != NULL);
assert(block->HasFlag(BBF_FUNCLET_BEG));
assert(compiler->bbIsFuncletBeg(block));

ScopedSetVariable<bool> _setGeneratingProlog(&compiler->compGeneratingProlog, true);

Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/jit/codegenarm64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1390,7 +1390,7 @@ void CodeGen::genFuncletProlog(BasicBlock* block)
#endif

assert(block != NULL);
assert(block->HasFlag(BBF_FUNCLET_BEG));
assert(compiler->bbIsFuncletBeg(block));

ScopedSetVariable<bool> _setGeneratingProlog(&compiler->compGeneratingProlog, true);

Expand Down
5 changes: 3 additions & 2 deletions src/coreclr/jit/codegencommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1695,7 +1695,7 @@ void CodeGen::genCheckOverflow(GenTree* tree)
/*****************************************************************************
*
* Update the current funclet as needed by calling genUpdateCurrentFunclet().
* For non-BBF_FUNCLET_BEG blocks, it asserts that the current funclet
* For blocks that aren't at the beginning of a funclet, it asserts that the current funclet
* is up-to-date.
*
*/
Expand All @@ -1707,7 +1707,8 @@ void CodeGen::genUpdateCurrentFunclet(BasicBlock* block)
return;
}

if (block->HasFlag(BBF_FUNCLET_BEG))
assert(compiler->fgFuncletsCreated);
if (compiler->bbIsHandlerBeg(block))
{
compiler->funSetCurrentFunc(compiler->funGetFuncIdx(block));
if (compiler->funCurrentFunc()->funKind == FUNC_FILTER)
Expand Down
5 changes: 2 additions & 3 deletions src/coreclr/jit/codegenlinear.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -372,9 +372,8 @@ void CodeGen::genCodeForBBlist()

bool firstMapping = true;

if (block->HasFlag(BBF_FUNCLET_BEG))
if (compiler->bbIsFuncletBeg(block))
{
assert(compiler->UsesFunclets());
genReserveFuncletProlog(block);
}

Expand Down Expand Up @@ -711,7 +710,7 @@ void CodeGen::genCodeForBBlist()
// 2. If this is this is the last block of the hot section.
// 3. If the subsequent block is a special throw block.
// 4. On AMD64, if the next block is in a different EH region.
if (block->IsLast() || block->Next()->HasFlag(BBF_FUNCLET_BEG) ||
if (block->IsLast() || compiler->bbIsFuncletBeg(block->Next()) ||
!BasicBlock::sameEHRegion(block, block->Next()) ||
(!isFramePointerUsed() && compiler->fgIsThrowHlpBlk(block->Next())) ||
block->IsLastHotBlock(compiler))
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/jit/codegenloongarch64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ void CodeGen::genFuncletProlog(BasicBlock* block)
#endif

assert(block != NULL);
assert(block->HasFlag(BBF_FUNCLET_BEG));
assert(compiler->bbIsFuncletBeg(block));

ScopedSetVariable<bool> _setGeneratingProlog(&compiler->compGeneratingProlog, true);

Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/jit/codegenriscv64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ void CodeGen::genFuncletProlog(BasicBlock* block)
// TODO-RISCV64: Implement varargs (NYI_RISCV64)

assert(block != NULL);
assert(block->HasFlag(BBF_FUNCLET_BEG));
assert(compiler->bbIsFuncletBeg(block));

ScopedSetVariable<bool> _setGeneratingProlog(&compiler->compGeneratingProlog, true);

Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/jit/codegenxarch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10912,7 +10912,7 @@ void CodeGen::genFuncletProlog(BasicBlock* block)

assert(!regSet.rsRegsModified(RBM_FPBASE));
assert(block != nullptr);
assert(block->HasFlag(BBF_FUNCLET_BEG));
assert(compiler->bbIsFuncletBeg(block));
assert(isFramePointerUsed());

ScopedSetVariable<bool> _setGeneratingProlog(&compiler->compGeneratingProlog, true);
Expand Down
3 changes: 3 additions & 0 deletions src/coreclr/jit/compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -2733,6 +2733,9 @@ class Compiler
// Returns true if "block" is the start of a handler or filter region.
bool bbIsHandlerBeg(const BasicBlock* block);

// Returns true if "block" is the start of a funclet.
bool bbIsFuncletBeg(const BasicBlock* block);

bool ehHasCallableHandlers();

// Return the EH descriptor for the given region index.
Expand Down
5 changes: 2 additions & 3 deletions src/coreclr/jit/compiler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -887,7 +887,7 @@ inline FuncInfoDsc* Compiler::funGetFunc(unsigned funcIdx)
/*****************************************************************************
* Get the funcIdx for the EH funclet that begins with block.
* This is only valid after funclets are created.
* It is only valid for blocks marked with BBF_FUNCLET_BEG because
* It is only valid for blocks that begin a funclet because
* otherwise we would have to do a more expensive check to determine
* if this should return the filter funclet or the filter handler funclet.
*
Expand All @@ -896,8 +896,7 @@ inline unsigned Compiler::funGetFuncIdx(BasicBlock* block)
{
if (UsesFunclets())
{
assert(fgFuncletsCreated);
assert(block->HasFlag(BBF_FUNCLET_BEG));
assert(bbIsFuncletBeg(block));

EHblkDsc* eh = ehGetDsc(block->getHndIndex());
unsigned int funcIdx = eh->ebdFuncIndex;
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/jit/emit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6515,7 +6515,7 @@ void emitter::emitCheckFuncletBranch(instrDesc* jmp, insGroup* jmpIG)

// Only to the first block of the finally (which is properly marked)
BasicBlock* tgtBlk = tgtEH->ebdHndBeg;
assert(tgtBlk->HasFlag(BBF_FUNCLET_BEG));
assert(emitComp->bbIsFuncletBeg(tgtBlk));

// And now we made it back to where we started
assert(tgtIG == emitCodeGetCookie(tgtBlk));
Expand Down
14 changes: 2 additions & 12 deletions src/coreclr/jit/fgbasic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4642,8 +4642,8 @@ BasicBlock* Compiler::fgSplitBlockAtEnd(BasicBlock* curr)
newBlock->CopyFlags(curr);

// Remove flags that the new block can't have.
newBlock->RemoveFlags(BBF_LOOP_HEAD | BBF_FUNCLET_BEG | BBF_KEEP_BBJ_ALWAYS | BBF_PATCHPOINT |
BBF_BACKWARD_JUMP_TARGET | BBF_LOOP_ALIGN);
newBlock->RemoveFlags(BBF_LOOP_HEAD | BBF_KEEP_BBJ_ALWAYS | BBF_PATCHPOINT | BBF_BACKWARD_JUMP_TARGET |
BBF_LOOP_ALIGN);

// Remove the GC safe bit on the new block. It seems clear that if we split 'curr' at the end,
// such that all the code is left in 'curr', and 'newBlock' just gets the control flow, then
Expand Down Expand Up @@ -5574,16 +5574,6 @@ BasicBlock* Compiler::fgRelocateEHRange(unsigned regionIndex, FG_RELOCATE_TYPE r

#endif // DEBUG

if (UsesFunclets())
{
bStart->SetFlags(BBF_FUNCLET_BEG); // Mark the start block of the funclet

if (bMiddle != nullptr)
{
bMiddle->SetFlags(BBF_FUNCLET_BEG); // Also mark the start block of a filter handler as a funclet
}
}

BasicBlock* bNext;
bNext = bLast->Next();

Expand Down
21 changes: 6 additions & 15 deletions src/coreclr/jit/fgdiagnostic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -817,18 +817,19 @@ bool Compiler::fgDumpFlowGraph(Phases phase, PhasePosition pos)
if (displayBlockFlags)
{
// Don't display the `[` `]` unless we're going to display something.
const bool isTryEntryBlock = bbIsTryBeg(block);
const bool isTryEntryBlock = bbIsTryBeg(block);
const bool isFuncletEntryBlock = bbIsFuncletBeg(block);

if (isTryEntryBlock ||
block->HasAnyFlag(BBF_FUNCLET_BEG | BBF_RUN_RARELY | BBF_LOOP_HEAD | BBF_LOOP_ALIGN))
if (isTryEntryBlock || isFuncletEntryBlock ||
block->HasAnyFlag(BBF_RUN_RARELY | BBF_LOOP_HEAD | BBF_LOOP_ALIGN))
{
// Display a very few, useful, block flags
fprintf(fgxFile, " [");
if (isTryEntryBlock)
{
fprintf(fgxFile, "T");
}
if (block->HasFlag(BBF_FUNCLET_BEG))
if (isFuncletEntryBlock)
{
fprintf(fgxFile, "F");
}
Expand Down Expand Up @@ -2104,15 +2105,6 @@ void Compiler::fgTableDispBasicBlock(const BasicBlock* block,
printf(" ");
}

if (flags & BBF_FUNCLET_BEG)
{
printf("F ");
}
else
{
printf(" ");
}

int cnt = 0;

switch (block->bbCatchTyp)
Expand Down Expand Up @@ -2935,8 +2927,7 @@ void Compiler::fgDebugCheckBBlist(bool checkBBNum /* = false */, bool checkBBRef
//
if (fgFirstFuncletBB != nullptr)
{
assert(fgFirstFuncletBB->hasHndIndex() == true);
assert(fgFirstFuncletBB->HasFlag(BBF_FUNCLET_BEG));
assert(bbIsFuncletBeg(fgFirstFuncletBB));
}
}

Expand Down
3 changes: 1 addition & 2 deletions src/coreclr/jit/fgopt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -814,8 +814,7 @@ bool Compiler::fgCanCompactBlock(BasicBlock* block)
// If target has multiple incoming edges, we can still compact if block is empty.
// However, not if it is the beginning of a handler.
//
if (target->countOfInEdges() != 1 &&
(!block->isEmpty() || block->HasFlag(BBF_FUNCLET_BEG) || (block->bbCatchTyp != BBCT_NONE)))
if (target->countOfInEdges() != 1 && (!block->isEmpty() || (block->bbCatchTyp != BBCT_NONE)))
{
return false;
}
Expand Down
36 changes: 15 additions & 21 deletions src/coreclr/jit/jiteh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -640,6 +640,16 @@ bool Compiler::bbIsHandlerBeg(const BasicBlock* block)
return (ehDsc != nullptr) && ((block == ehDsc->ebdHndBeg) || (ehDsc->HasFilter() && (block == ehDsc->ebdFilter)));
}

bool Compiler::bbIsFuncletBeg(const BasicBlock* block)
{
if (UsesFunclets() && fgFuncletsCreated)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we even be asking this if fgFuncletsCreated is false?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps rearrange so we assert(fgFuncletsCreated); under if(UsesFunclets())?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I started working on this, we had some paths where we would check for funclet start blocks before and after funclets were created, like in fgCanCompactBlock. I've since been able to remove these checks, so we can make the fgFuncletsCreated check an invariant.

{
return bbIsHandlerBeg(block);
}

return false;
}

bool Compiler::ehHasCallableHandlers()
{
if (UsesFunclets())
Expand Down Expand Up @@ -3287,11 +3297,11 @@ void Compiler::fgVerifyHandlerTab()

if (fgFuncletsCreated)
{
assert(HBtab->ebdHndBeg->HasFlag(BBF_FUNCLET_BEG));
assert(bbIsFuncletBeg(HBtab->ebdHndBeg));

if (HBtab->HasFilter())
{
assert(HBtab->ebdFilter->HasFlag(BBF_FUNCLET_BEG));
assert(bbIsFuncletBeg(HBtab->ebdFilter));
}
}
}
Expand Down Expand Up @@ -3728,11 +3738,9 @@ void Compiler::fgVerifyHandlerTab()
{
assert(block->bbCatchTyp == BBCT_NONE);

if (fgFuncletsCreated)
{
// Make sure blocks that aren't the first block of a funclet do not have the BBF_FUNCLET_BEG flag set.
assert(!block->HasFlag(BBF_FUNCLET_BEG));
}
// If this block wasn't marked as an EH handler 'begin' block,
// it shouldn't be the beginning of a funclet.
assert(!bbIsFuncletBeg(block));
}

// Check for legal block types
Expand Down Expand Up @@ -4469,13 +4477,6 @@ void Compiler::fgExtendEHRegionBefore(BasicBlock* block)
block->bbRefs--;
bPrev->bbRefs++;

if (fgFuncletsCreated)
{
assert(block->HasFlag(BBF_FUNCLET_BEG));
bPrev->SetFlags(BBF_FUNCLET_BEG);
block->RemoveFlags(BBF_FUNCLET_BEG);
}

// If this is a handler for a filter, the last block of the filter will end with
// a BBJ_EHFILTERRET block that jumps to the first block of its handler.
// So we need to update it to keep things in sync.
Expand Down Expand Up @@ -4514,13 +4515,6 @@ void Compiler::fgExtendEHRegionBefore(BasicBlock* block)
HBtab->ebdFilter = bPrev;
bPrev->SetFlags(BBF_DONT_REMOVE);

if (fgFuncletsCreated)
{
assert(block->HasFlag(BBF_FUNCLET_BEG));
bPrev->SetFlags(BBF_FUNCLET_BEG);
block->RemoveFlags(BBF_FUNCLET_BEG);
}

bPrev->bbRefs++;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/jit/scopeinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1485,7 +1485,7 @@ void CodeGen::siBeginBlock(BasicBlock* block)
return;
}

if (block->HasFlag(BBF_FUNCLET_BEG))
if (compiler->bbIsFuncletBeg(block))
{
// For now, don't report any scopes in funclets. JIT64 doesn't.
siInFuncletRegion = true;
Expand Down
Loading