Skip to content

Commit 15f10e6

Browse files
committed
Revert "Skip unprofitable cases"
This reverts commit 112370f.
1 parent a16bf35 commit 15f10e6

3 files changed

Lines changed: 1 addition & 50 deletions

File tree

src/coreclr/jit/lower.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5059,7 +5059,7 @@ bool Lowering::IsFieldListCompatibleWithReturn(GenTreeFieldList* fieldList)
50595059
}
50605060

50615061
var_types fieldType = genActualType(use.GetNode());
5062-
var_types regType = genActualType(retDesc.GetReturnRegType(regIndex));
5062+
var_types regType = retDesc.GetReturnRegType(regIndex);
50635063
if (genTypeSize(fieldType) != genTypeSize(regType))
50645064
{
50655065
JITDUMP("it is not; field %u register has type %s but field has type %s\n", regIndex, varTypeName(regType),

src/coreclr/jit/promotion.cpp

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -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

src/coreclr/jit/promotion.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,6 @@ class ReplaceVisitor : public GenTreeVisitor<ReplaceVisitor>
296296

297297
bool ReplaceStructLocal(GenTree* user, GenTreeLclVarCommon* value);
298298
bool ReplaceReturnedStructLocal(GenTreeOp* ret, GenTreeLclVarCommon* value);
299-
bool IsReturnProfitableAsFieldList(GenTreeLclVarCommon* value);
300299
bool ReplaceCallArgWithFieldList(GenTreeCall* call, GenTreeLclVarCommon* callArg);
301300
bool CanReplaceCallArgWithFieldListOfReplacements(GenTreeCall* call, CallArg* callArg, GenTreeLclVarCommon* lcl);
302301
void ReadBackAfterCall(GenTreeCall* call, GenTree* user);

0 commit comments

Comments
 (0)