diff --git a/src/coreclr/jit/compiler.h b/src/coreclr/jit/compiler.h index 6678a0a6d9f21..91d4350e0afda 100644 --- a/src/coreclr/jit/compiler.h +++ b/src/coreclr/jit/compiler.h @@ -9407,9 +9407,11 @@ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX return IsInstrumented() && jitFlags->IsSet(JitFlags::JIT_FLAG_BBOPT); } - bool IsInstrumentedOrOptimized() const + bool CanBeInstrumentedOrIsOptimized() const { - return IsInstrumented() || jitFlags->IsSet(JitFlags::JIT_FLAG_BBOPT); + return IsInstrumented() || (jitFlags->IsSet(JitFlags::JIT_FLAG_TIER0) && + jitFlags->IsSet(JitFlags::JIT_FLAG_BBINSTR_IF_LOOPS)) || + jitFlags->IsSet(JitFlags::JIT_FLAG_BBOPT); } // true if we should use the PINVOKE_{BEGIN,END} helpers instead of generating diff --git a/src/coreclr/jit/fgbasic.cpp b/src/coreclr/jit/fgbasic.cpp index cb627fd3b434b..7b19cfd06c915 100644 --- a/src/coreclr/jit/fgbasic.cpp +++ b/src/coreclr/jit/fgbasic.cpp @@ -1826,7 +1826,7 @@ void Compiler::fgFindJumpTargets(const BYTE* codeAddr, IL_OFFSET codeSize, Fixed if ((jmpDist == 0) && (opcode == CEE_LEAVE || opcode == CEE_LEAVE_S || opcode == CEE_BR || opcode == CEE_BR_S) && - opts.IsInstrumentedOrOptimized()) + opts.CanBeInstrumentedOrIsOptimized()) { break; /* NOP */ } @@ -2975,7 +2975,7 @@ unsigned Compiler::fgMakeBasicBlocks(const BYTE* codeAddr, IL_OFFSET codeSize, F jmpDist = (sz == 1) ? getI1LittleEndian(codeAddr) : getI4LittleEndian(codeAddr); - if ((jmpDist == 0) && (opcode == CEE_BR || opcode == CEE_BR_S) && opts.IsInstrumentedOrOptimized()) + if ((jmpDist == 0) && (opcode == CEE_BR || opcode == CEE_BR_S) && opts.CanBeInstrumentedOrIsOptimized()) { continue; /* NOP */ } diff --git a/src/coreclr/jit/importer.cpp b/src/coreclr/jit/importer.cpp index e4238fcf7196f..e6b3bb4d03c97 100644 --- a/src/coreclr/jit/importer.cpp +++ b/src/coreclr/jit/importer.cpp @@ -7476,7 +7476,7 @@ void Compiler::impImportBlockCode(BasicBlock* block) case CEE_BR_S: jmpDist = (sz == 1) ? getI1LittleEndian(codeAddr) : getI4LittleEndian(codeAddr); - if ((jmpDist == 0) && opts.IsInstrumentedOrOptimized()) + if ((jmpDist == 0) && opts.CanBeInstrumentedOrIsOptimized()) { break; /* NOP */ }