Skip to content
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
9 changes: 7 additions & 2 deletions src/coreclr/jit/compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -9464,9 +9464,14 @@ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
return jitFlags->IsSet(JitFlags::JIT_FLAG_BBINSTR);
}

bool IsInstrumentedOptimized() const
bool IsInstrumentedAndOptimized() const
{
return IsInstrumented() && jitFlags->IsSet(JitFlags::JIT_FLAG_TIER1);
return IsInstrumented() && jitFlags->IsSet(JitFlags::JIT_FLAG_BBOPT);
}

bool IsInstrumentedOrOptimized() const
{
return IsInstrumented() || jitFlags->IsSet(JitFlags::JIT_FLAG_BBOPT);
}

// true if we should use the PINVOKE_{BEGIN,END} helpers instead of generating
Expand Down
7 changes: 4 additions & 3 deletions src/coreclr/jit/fgbasic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1824,8 +1824,9 @@ void Compiler::fgFindJumpTargets(const BYTE* codeAddr, IL_OFFSET codeSize, Fixed
// Compute jump target address
signed jmpDist = (sz == 1) ? getI1LittleEndian(codeAddr) : getI4LittleEndian(codeAddr);

if (compIsForInlining() && jmpDist == 0 &&
(opcode == CEE_LEAVE || opcode == CEE_LEAVE_S || opcode == CEE_BR || opcode == CEE_BR_S))
if ((jmpDist == 0) &&
(opcode == CEE_LEAVE || opcode == CEE_LEAVE_S || opcode == CEE_BR || opcode == CEE_BR_S) &&
opts.IsInstrumentedOrOptimized())
{
break; /* NOP */
}
Expand Down Expand Up @@ -2974,7 +2975,7 @@ unsigned Compiler::fgMakeBasicBlocks(const BYTE* codeAddr, IL_OFFSET codeSize, F

jmpDist = (sz == 1) ? getI1LittleEndian(codeAddr) : getI4LittleEndian(codeAddr);

if (compIsForInlining() && jmpDist == 0 && (opcode == CEE_BR || opcode == CEE_BR_S))
if ((jmpDist == 0) && (opcode == CEE_BR || opcode == CEE_BR_S) && opts.IsInstrumentedOrOptimized())
{
continue; /* NOP */
}
Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/jit/fgprofile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ void BlockCountInstrumentor::RelocateProbes()
{
// We only see such blocks when optimizing. They are flagged by the importer.
//
if (!m_comp->opts.IsInstrumentedOptimized() || ((m_comp->optMethodFlags & OMF_HAS_TAILCALL_SUCCESSOR) == 0))
if (!m_comp->opts.IsInstrumentedAndOptimized() || ((m_comp->optMethodFlags & OMF_HAS_TAILCALL_SUCCESSOR) == 0))
{
// No problematic blocks to worry about.
//
Expand Down Expand Up @@ -1616,7 +1616,7 @@ void EfficientEdgeCountInstrumentor::RelocateProbes()
{
// We only see such blocks when optimizing. They are flagged by the importer.
//
if (!m_comp->opts.IsInstrumentedOptimized() || ((m_comp->optMethodFlags & OMF_HAS_TAILCALL_SUCCESSOR) == 0))
if (!m_comp->opts.IsInstrumentedAndOptimized() || ((m_comp->optMethodFlags & OMF_HAS_TAILCALL_SUCCESSOR) == 0))
{
// No problematic blocks to worry about.
//
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/jit/importer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7476,7 +7476,7 @@ void Compiler::impImportBlockCode(BasicBlock* block)
case CEE_BR_S:
jmpDist = (sz == 1) ? getI1LittleEndian(codeAddr) : getI4LittleEndian(codeAddr);

if (compIsForInlining() && jmpDist == 0)
if ((jmpDist == 0) && opts.IsInstrumentedOrOptimized())
{
break; /* NOP */
}
Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/jit/importercalls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1282,7 +1282,7 @@ var_types Compiler::impImportCall(OPCODE opcode,
// have to check for anything that might introduce a recursive tail call.
// * We only instrument root method blocks in OSR methods,
//
if ((opts.IsInstrumentedOptimized() || opts.IsOSR()) && !compIsForInlining())
if ((opts.IsInstrumentedAndOptimized() || opts.IsOSR()) && !compIsForInlining())
{
// If a root method tail call candidate block is not a BBJ_RETURN, it should have a unique
// BBJ_RETURN successor. Mark that successor so we can handle it specially during profile
Expand Down Expand Up @@ -7201,7 +7201,7 @@ bool Compiler::impConsiderCallProbe(GenTreeCall* call, IL_OFFSET ilOffset)
return false;
}

assert(opts.OptimizationDisabled() || opts.IsInstrumentedOptimized());
assert(opts.OptimizationDisabled() || opts.IsInstrumentedAndOptimized());
assert(!compIsForInlining());

// During importation, optionally flag this block as one that
Expand Down