@@ -2306,11 +2306,6 @@ bool ReplaceVisitor::ReplaceReturnedStructLocal(GenTreeOp* ret, GenTreeLclVarCom
23062306 return false ;
23072307 }
23082308
2309- if (!IsReturnProfitableAsFieldList (value))
2310- {
2311- return false ;
2312- }
2313-
23142309 StructDeaths deaths = m_liveness->GetDeathsForStructLocal (value);
23152310 GenTreeFieldList* fieldList = m_compiler->gtNewFieldList ();
23162311
@@ -2348,49 +2343,6 @@ bool ReplaceVisitor::ReplaceReturnedStructLocal(GenTreeOp* ret, GenTreeLclVarCom
23482343 return true ;
23492344}
23502345
2351- // ------------------------------------------------------------------------
2352- // IsReturnProfitableAsFieldList:
2353- // Check if a returned local is expected to be profitable to turn into a
2354- // FIELD_LIST.
2355- //
2356- // Parameters:
2357- // value - The struct local
2358- //
2359- // Returns:
2360- // True if so.
2361- //
2362- bool ReplaceVisitor::IsReturnProfitableAsFieldList (GenTreeLclVarCommon* value)
2363- {
2364- // Currently the backend requires all fields to map cleanly to registers to
2365- // efficiently return them. Otherwise they will be spilled, and we are
2366- // better off decomposing the store here.
2367- auto fieldMapsCleanly = [=](Replacement& rep) {
2368- const ReturnTypeDesc& retDesc = m_compiler->compRetTypeDesc ;
2369- unsigned fieldOffset = rep.Offset - value->GetLclOffs ();
2370- unsigned numRegs = retDesc.GetReturnRegCount ();
2371- for (unsigned i = 0 ; i < numRegs; i++)
2372- {
2373- unsigned offset = retDesc.GetReturnFieldOffset (i);
2374- var_types regType = retDesc.GetReturnRegType (i);
2375- if ((fieldOffset == offset) && (genTypeSize (rep.AccessType ) == genTypeSize (regType)))
2376- {
2377- return true ;
2378- }
2379- }
2380-
2381- return false ;
2382- };
2383-
2384- unsigned size = value->GetLayout (m_compiler)->GetSize ();
2385- if (!VisitOverlappingReplacements (value->GetLclNum (), value->GetLclOffs (), size, fieldMapsCleanly))
2386- {
2387- // Aborted early, so a field did not map
2388- return false ;
2389- }
2390-
2391- return true ;
2392- }
2393-
23942346// ------------------------------------------------------------------------
23952347// ReplaceCallArgWithFieldList:
23962348// Handle a call that may pass a struct local with replacements as the
0 commit comments