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

Remove unused block flags #82330

Merged
merged 1 commit into from
Feb 18, 2023
Merged
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: 0 additions & 8 deletions src/coreclr/jit/block.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -368,18 +368,10 @@ void BasicBlock::dspBlockILRange() const
//
void BasicBlock::dspFlags()
{
if (bbFlags & BBF_VISITED)
{
printf("v ");
}
if (bbFlags & BBF_MARKED)
{
printf("m ");
}
if (bbFlags & BBF_CHANGED)
{
printf("! ");
}
if (bbFlags & BBF_REMOVED)
{
printf("del ");
Expand Down
94 changes: 41 additions & 53 deletions src/coreclr/jit/block.h
Original file line number Diff line number Diff line change
Expand Up @@ -471,41 +471,39 @@ enum BasicBlockFlags : unsigned __int64
#define MAKE_BBFLAG(bit) (1ULL << (bit))
BBF_EMPTY = 0,

BBF_VISITED = MAKE_BBFLAG( 0), // BB visited during optimizations
BBF_IS_LIR = MAKE_BBFLAG( 0), // Set if the basic block contains LIR (as opposed to HIR)
BBF_MARKED = MAKE_BBFLAG( 1), // BB marked during optimizations
BBF_CHANGED = MAKE_BBFLAG( 2), // input/output of this block has changed
BBF_REMOVED = MAKE_BBFLAG( 3), // BB has been removed from bb-list

BBF_DONT_REMOVE = MAKE_BBFLAG( 4), // BB should not be removed during flow graph optimizations
BBF_IMPORTED = MAKE_BBFLAG( 5), // BB byte-code has been imported
BBF_INTERNAL = MAKE_BBFLAG( 6), // BB has been added by the compiler
BBF_FAILED_VERIFICATION = MAKE_BBFLAG( 7), // BB has verification exception

BBF_TRY_BEG = MAKE_BBFLAG( 8), // BB starts a 'try' block
BBF_FUNCLET_BEG = MAKE_BBFLAG( 9), // BB is the beginning of a funclet
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
BBF_LOOP_CALL0 = MAKE_BBFLAG(14), // BB starts a loop that sometimes won't call
BBF_LOOP_CALL1 = MAKE_BBFLAG(15), // BB starts a loop that will always call

BBF_HAS_LABEL = MAKE_BBFLAG(16), // BB needs a label
BBF_LOOP_ALIGN = MAKE_BBFLAG(17), // Block is lexically the first block in a loop we intend to align.
BBF_HAS_JMP = MAKE_BBFLAG(18), // BB executes a JMP instruction (instead of return)
BBF_GC_SAFE_POINT = MAKE_BBFLAG(19), // BB has a GC safe point (a call). More abstractly, BB does not require a
BBF_REMOVED = MAKE_BBFLAG( 2), // BB has been removed from bb-list
BBF_DONT_REMOVE = MAKE_BBFLAG( 3), // BB should not be removed during flow graph optimizations
BBF_IMPORTED = MAKE_BBFLAG( 4), // BB byte-code has been imported
BBF_INTERNAL = MAKE_BBFLAG( 5), // BB has been added by the compiler
BBF_FAILED_VERIFICATION = MAKE_BBFLAG( 6), // BB has verification exception
BBF_TRY_BEG = MAKE_BBFLAG( 7), // BB starts a 'try' block
BBF_FUNCLET_BEG = MAKE_BBFLAG( 8), // BB is the beginning of a funclet
BBF_CLONED_FINALLY_BEGIN = MAKE_BBFLAG( 9), // First block of a cloned finally region
BBF_CLONED_FINALLY_END = MAKE_BBFLAG(10), // Last block of a cloned finally region
BBF_HAS_NULLCHECK = MAKE_BBFLAG(11), // BB contains a null check
BBF_HAS_SUPPRESSGC_CALL = MAKE_BBFLAG(12), // BB contains a call to a method with SuppressGCTransitionAttribute
BBF_RUN_RARELY = MAKE_BBFLAG(13), // BB is rarely run (catch clauses, blocks with throws etc)
BBF_LOOP_HEAD = MAKE_BBFLAG(14), // BB is the head of a loop
BBF_LOOP_CALL0 = MAKE_BBFLAG(15), // BB starts a loop that sometimes won't call
BBF_LOOP_CALL1 = MAKE_BBFLAG(16), // BB starts a loop that will always call
BBF_HAS_LABEL = MAKE_BBFLAG(17), // BB needs a label
BBF_LOOP_ALIGN = MAKE_BBFLAG(18), // Block is lexically the first block in a loop we intend to align.
BBF_HAS_ALIGN = MAKE_BBFLAG(19), // BB ends with 'align' instruction
BBF_HAS_JMP = MAKE_BBFLAG(20), // BB executes a JMP instruction (instead of return)
BBF_GC_SAFE_POINT = MAKE_BBFLAG(21), // BB has a GC safe point (a call). More abstractly, BB does not require a
// (further) poll -- this may be because this BB has a call, or, in some
// cases, because the BB occurs in a loop, and we've determined that all
// paths in the loop body leading to BB include a call.

BBF_HAS_IDX_LEN = MAKE_BBFLAG(20), // BB contains simple index or length expressions on an SD array local var.
BBF_HAS_MD_IDX_LEN = MAKE_BBFLAG(21), // BB contains simple index, length, or lower bound expressions on an MD array local var.
BBF_HAS_NEWOBJ = MAKE_BBFLAG(22), // BB contains 'new' of an object type.
BBF_HAS_IDX_LEN = MAKE_BBFLAG(22), // BB contains simple index or length expressions on an SD array local var.
BBF_HAS_MD_IDX_LEN = MAKE_BBFLAG(23), // BB contains simple index, length, or lower bound expressions on an MD array local var.
BBF_HAS_MDARRAYREF = MAKE_BBFLAG(24), // Block has a multi-dimensional array reference
BBF_HAS_NEWOBJ = MAKE_BBFLAG(25), // BB contains 'new' of an object type.

#if defined(FEATURE_EH_FUNCLETS) && defined(TARGET_ARM)

BBF_FINALLY_TARGET = MAKE_BBFLAG(23), // BB is the target of a finally return: where a finally will return during
BBF_FINALLY_TARGET = MAKE_BBFLAG(26), // BB is the target of a finally return: where a finally will return during
// non-exceptional flow. Because the ARM calling sequence for calling a
// finally explicitly sets the return address to the finally target and jumps
// to the finally, instead of using a call instruction, ARM needs this to
Expand All @@ -514,35 +512,25 @@ enum BasicBlockFlags : unsigned __int64

#endif // defined(FEATURE_EH_FUNCLETS) && defined(TARGET_ARM)

BBF_BACKWARD_JUMP = MAKE_BBFLAG(24), // BB is surrounded by a backward jump/switch arc
BBF_RETLESS_CALL = MAKE_BBFLAG(25), // BBJ_CALLFINALLY that will never return (and therefore, won't need a paired
BBF_RETLESS_CALL = MAKE_BBFLAG(27), // BBJ_CALLFINALLY that will never return (and therefore, won't need a paired
// BBJ_ALWAYS); see isBBCallAlwaysPair().
BBF_LOOP_PREHEADER = MAKE_BBFLAG(26), // BB is a loop preheader block
BBF_COLD = MAKE_BBFLAG(27), // BB is cold

BBF_PROF_WEIGHT = MAKE_BBFLAG(28), // BB weight is computed from profile data
BBF_IS_LIR = MAKE_BBFLAG(29), // Set if the basic block contains LIR (as opposed to HIR)
BBF_KEEP_BBJ_ALWAYS = MAKE_BBFLAG(30), // A special BBJ_ALWAYS block, used by EH code generation. Keep the jump kind
BBF_LOOP_PREHEADER = MAKE_BBFLAG(28), // BB is a loop preheader block
BBF_COLD = MAKE_BBFLAG(29), // BB is cold
BBF_PROF_WEIGHT = MAKE_BBFLAG(30), // BB weight is computed from profile data
BBF_KEEP_BBJ_ALWAYS = MAKE_BBFLAG(31), // A special BBJ_ALWAYS block, used by EH code generation. Keep the jump kind
// as BBJ_ALWAYS. Used for the paired BBJ_ALWAYS block following the
// BBJ_CALLFINALLY block, as well as, on x86, the final step block out of a
// finally.
BBF_CLONED_FINALLY_BEGIN = MAKE_BBFLAG(31), // First block of a cloned finally region

BBF_CLONED_FINALLY_END = MAKE_BBFLAG(32), // Last block of a cloned finally region
BBF_HAS_CALL = MAKE_BBFLAG(33), // BB contains a call
BBF_DOMINATED_BY_EXCEPTIONAL_ENTRY = MAKE_BBFLAG(34), // Block is dominated by exceptional entry.
BBF_BACKWARD_JUMP_TARGET = MAKE_BBFLAG(35), // Block is a target of a backward jump

BBF_PATCHPOINT = MAKE_BBFLAG(36), // Block is a patchpoint
BBF_HAS_HISTOGRAM_PROFILE = MAKE_BBFLAG(37), // BB contains a call needing a histogram profile
BBF_HAS_CALL = MAKE_BBFLAG(32), // BB contains a call
BBF_DOMINATED_BY_EXCEPTIONAL_ENTRY = MAKE_BBFLAG(33), // Block is dominated by exceptional entry.
BBF_BACKWARD_JUMP = MAKE_BBFLAG(34), // BB is surrounded by a backward jump/switch arc
BBF_BACKWARD_JUMP_SOURCE = MAKE_BBFLAG(35), // Block is a source of a backward jump
BBF_BACKWARD_JUMP_TARGET = MAKE_BBFLAG(36), // Block is a target of a backward jump
BBF_PATCHPOINT = MAKE_BBFLAG(37), // Block is a patchpoint
BBF_PARTIAL_COMPILATION_PATCHPOINT = MAKE_BBFLAG(38), // Block is a partial compilation patchpoint
BBF_HAS_ALIGN = MAKE_BBFLAG(39), // BB ends with 'align' instruction
BBF_HAS_HISTOGRAM_PROFILE = MAKE_BBFLAG(39), // BB contains a call needing a histogram profile
BBF_TAILCALL_SUCCESSOR = MAKE_BBFLAG(40), // BB has pred that has potential tail call

BBF_BACKWARD_JUMP_SOURCE = MAKE_BBFLAG(41), // Block is a source of a backward jump
BBF_HAS_MDARRAYREF = MAKE_BBFLAG(42), // Block has a multi-dimensional array reference

BBF_RECURSIVE_TAILCALL = MAKE_BBFLAG(43), // Block has recursive tailcall that may turn into a loop
BBF_RECURSIVE_TAILCALL = MAKE_BBFLAG(41), // Block has recursive tailcall that may turn into a loop

// The following are sets of flags.

Expand All @@ -552,12 +540,12 @@ enum BasicBlockFlags : unsigned __int64

// Flags to update when two blocks are compacted

BBF_COMPACT_UPD = BBF_CHANGED | BBF_GC_SAFE_POINT | BBF_HAS_JMP | BBF_HAS_IDX_LEN | BBF_HAS_MD_IDX_LEN | BBF_BACKWARD_JUMP | \
BBF_COMPACT_UPD = BBF_GC_SAFE_POINT | BBF_HAS_JMP | BBF_HAS_IDX_LEN | BBF_HAS_MD_IDX_LEN | BBF_BACKWARD_JUMP | \
BBF_HAS_NEWOBJ | BBF_HAS_NULLCHECK | BBF_HAS_MDARRAYREF,

// Flags a block should not have had before it is split.

BBF_SPLIT_NONEXIST = BBF_CHANGED | BBF_LOOP_HEAD | BBF_LOOP_CALL0 | BBF_LOOP_CALL1 | BBF_RETLESS_CALL | BBF_LOOP_PREHEADER | BBF_COLD,
BBF_SPLIT_NONEXIST = BBF_LOOP_HEAD | BBF_LOOP_CALL0 | BBF_LOOP_CALL1 | BBF_RETLESS_CALL | BBF_LOOP_PREHEADER | BBF_COLD,

// Flags lost by the top block when a block is split.
// Note, this is a conservative guess.
Expand Down
3 changes: 1 addition & 2 deletions src/coreclr/jit/liveness.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1046,8 +1046,7 @@ void Compiler::fgExtendDbgLifetimes()
{
printf("Created zero-init of V%02u in " FMT_BB "\n", varNum, block->bbNum);
}
#endif // DEBUG
block->bbFlags |= BBF_CHANGED; // indicates that the contents of the block have changed.
#endif // DEBUG
}

/* Update liveness information so that redoing fgLiveVarAnalysis()
Expand Down
14 changes: 7 additions & 7 deletions src/coreclr/jit/optcse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -785,9 +785,9 @@ bool Compiler::optValnumCSE_Locate()

compCurBB = block;

/* Ensure that the BBF_VISITED and BBF_MARKED flag are clear */
/* Everyone who uses these flags are required to clear afterwards */
noway_assert((block->bbFlags & (BBF_VISITED | BBF_MARKED)) == 0);
// Ensure that the BBF_MARKED flag is clear.
// Everyone who uses this flag is required to clear it afterwards.
noway_assert((block->bbFlags & BBF_MARKED) == 0);

/* Walk the statement trees in this basic block */
for (Statement* const stmt : block->NonPhiStatements())
Expand Down Expand Up @@ -3870,11 +3870,11 @@ void Compiler::optOptimizeCSEs()

void Compiler::optCleanupCSEs()
{
// We must clear the BBF_VISITED and BBF_MARKED flags.
// We must clear the BBF_MARKED flag.
for (BasicBlock* const block : Blocks())
{
// And clear all the "visited" bits on the block.
block->bbFlags &= ~(BBF_VISITED | BBF_MARKED);
// And clear the "marked" flag on the block.
block->bbFlags &= ~BBF_MARKED;

// Walk the statement trees in this basic block.
for (Statement* const stmt : block->NonPhiStatements())
Expand All @@ -3900,7 +3900,7 @@ void Compiler::optEnsureClearCSEInfo()
{
for (BasicBlock* const block : Blocks())
{
assert((block->bbFlags & (BBF_VISITED | BBF_MARKED)) == 0);
assert((block->bbFlags & BBF_MARKED) == 0);

for (Statement* const stmt : block->NonPhiStatements())
{
Expand Down