From dc796f7616ec59da2db21215cea74a9843991ad6 Mon Sep 17 00:00:00 2001 From: Jakob Botsch Nielsen Date: Tue, 2 May 2023 12:29:09 +0200 Subject: [PATCH] JIT: Prefer block copies for unenregisterable locals even with GC pointers (#85620) This comment seems outdated/wrong, the backend's block copy strategy when GC pointers are involved is highly tuned and often no helper is necessary at all. --- src/coreclr/jit/morphblock.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/coreclr/jit/morphblock.cpp b/src/coreclr/jit/morphblock.cpp index 2048612180f88..750efd2528fd7 100644 --- a/src/coreclr/jit/morphblock.cpp +++ b/src/coreclr/jit/morphblock.cpp @@ -917,14 +917,11 @@ void MorphCopyBlockHelper::MorphStructCases() // A struct with 8 bool fields will require 8 moves instead of one if we do this transformation. // A simple heuristic when field by field copy is preferred: // - if fields can be enregistered; - // - if the struct has GCPtrs (block copy would be done via helper that is expensive); // - if the struct has only one field. bool dstFldIsProfitable = - ((m_dstVarDsc != nullptr) && - (!m_dstVarDsc->lvDoNotEnregister || m_dstVarDsc->HasGCPtr() || (m_dstVarDsc->lvFieldCnt == 1))); + ((m_dstVarDsc != nullptr) && (!m_dstVarDsc->lvDoNotEnregister || (m_dstVarDsc->lvFieldCnt == 1))); bool srcFldIsProfitable = - ((m_srcVarDsc != nullptr) && - (!m_srcVarDsc->lvDoNotEnregister || m_srcVarDsc->HasGCPtr() || (m_srcVarDsc->lvFieldCnt == 1))); + ((m_srcVarDsc != nullptr) && (!m_srcVarDsc->lvDoNotEnregister || (m_srcVarDsc->lvFieldCnt == 1))); // Are both dest and src promoted structs? if (m_dstDoFldAsg && m_srcDoFldAsg && (dstFldIsProfitable || srcFldIsProfitable)) {