diff --git a/src/coreclr/interpreter/compiler.cpp b/src/coreclr/interpreter/compiler.cpp index ce3dd350da394b..93992918d80066 100644 --- a/src/coreclr/interpreter/compiler.cpp +++ b/src/coreclr/interpreter/compiler.cpp @@ -2870,17 +2870,9 @@ static bool DoesValueTypeContainGCRefs(COMP_HANDLE compHnd, CORINFO_CLASS_HANDLE // getClassGClayout assumes it's given a buffer of exactly this size unsigned maxGcPtrs = (size + sizeof(void *) - 1) / sizeof(void *); BYTE *gcLayout = (BYTE *)alloca(maxGcPtrs + 1); - uint32_t numSlots = compHnd->getClassGClayout(clsHnd, gcLayout); + uint32_t numGCRefs = compHnd->getClassGClayout(clsHnd, gcLayout); - for (uint32_t i = 0; i < numSlots; ++i) - { - if (gcLayout[i] != TYPE_GC_NONE) - { - return true; - } - } - - return false; + return numGCRefs > 0; } void InterpCompiler::ConvertFloatingPointStackEntryToStackType(StackInfo* entry, StackType type)