diff --git a/src/coreclr/jit/importer.cpp b/src/coreclr/jit/importer.cpp index 34db37c4d78ef..53e510410b3a0 100644 --- a/src/coreclr/jit/importer.cpp +++ b/src/coreclr/jit/importer.cpp @@ -9236,11 +9236,20 @@ void Compiler::impImportBlockCode(BasicBlock* block) { // Loading a static valuetype field usually will cause a JitHelper to be called // for the static base. This will bloat the code. - compInlineResult->Note(InlineObservation::CALLEE_LDFLD_STATIC_VALUECLASS); - if (compInlineResult->IsFailure()) + // Make an exception - small getters (6 bytes of IL) returning initialized fields, e.g.: + // + // static DateTime Foo { get; } = DateTime.Now; + // + bool isInitedFld = (opcode == CEE_LDSFLD) && (info.compILCodeSize <= 6) && + (fieldInfo.fieldFlags & CORINFO_FLG_FIELD_FINAL); + if (!isInitedFld) { - return; + compInlineResult->Note(InlineObservation::CALLEE_LDFLD_STATIC_VALUECLASS); + if (compInlineResult->IsFailure()) + { + return; + } } } }