File tree Expand file tree Collapse file tree 3 files changed +23
-3
lines changed Expand file tree Collapse file tree 3 files changed +23
-3
lines changed Original file line number Diff line number Diff line change @@ -387,6 +387,19 @@ class SubstitutePlaceholdersAndDevirtualizeWalker : public GenTreeVisitor<Substi
387
387
#endif // DEBUG
388
388
}
389
389
390
+ // If the inline was rejected and returns a retbuffer, then mark that
391
+ // local as DNER now so that promotion knows to leave it up to physical
392
+ // promotion.
393
+ if ((*use)->IsCall ())
394
+ {
395
+ CallArg* retBuffer = (*use)->AsCall ()->gtArgs .GetRetBufferArg ();
396
+ if ((retBuffer != nullptr ) && retBuffer->GetNode ()->OperIs (GT_LCL_ADDR))
397
+ {
398
+ m_compiler->lvaSetVarDoNotEnregister (retBuffer->GetNode ()->AsLclVarCommon ()->GetLclNum ()
399
+ DEBUGARG (DoNotEnregisterReason::HiddenBufferStructArg));
400
+ }
401
+ }
402
+
390
403
#if FEATURE_MULTIREG_RET
391
404
// If an inline was rejected and the call returns a struct, we may
392
405
// have deferred some work when importing call for cases where the
Original file line number Diff line number Diff line change @@ -851,6 +851,12 @@ GenTree* Compiler::impStoreStruct(GenTree* store,
851
851
GenTree* destAddr = impGetNodeAddr(store, CHECK_SPILL_ALL, &indirFlags);
852
852
NewCallArg newArg = NewCallArg::Primitive(destAddr).WellKnown(wellKnownArgType);
853
853
854
+ if (destAddr->OperIs(GT_LCL_ADDR))
855
+ {
856
+ lvaSetVarDoNotEnregister(destAddr->AsLclVarCommon()->GetLclNum()
857
+ DEBUGARG(DoNotEnregisterReason::HiddenBufferStructArg));
858
+ }
859
+
854
860
#if !defined(TARGET_ARM)
855
861
// Unmanaged instance methods on Windows or Unix X86 need the retbuf arg after the first (this) parameter
856
862
if ((TargetOS::IsWindows || compUnixX86Abi()) && srcCall->IsUnmanaged())
Original file line number Diff line number Diff line change @@ -2570,9 +2570,11 @@ bool Compiler::StructPromotionHelper::CanPromoteStructVar(unsigned lclNum)
2570
2570
return false ;
2571
2571
}
2572
2572
2573
- if (varDsc->IsAddressExposed () )
2573
+ if (varDsc->lvDoNotEnregister )
2574
2574
{
2575
- JITDUMP (" struct promotion of V%02u is disabled because it has already been marked address exposed\n " , lclNum);
2575
+ // Promoting structs that are marked DNER will result in dependent
2576
+ // promotion. Allow physical promotion to handle these.
2577
+ JITDUMP (" struct promotion of V%02u is disabled because it has already been marked DNER\n " , lclNum);
2576
2578
return false ;
2577
2579
}
2578
2580
@@ -3173,7 +3175,6 @@ void Compiler::lvaSetVarDoNotEnregister(unsigned varNum DEBUGARG(DoNotEnregister
3173
3175
break ;
3174
3176
case DoNotEnregisterReason::HiddenBufferStructArg:
3175
3177
JITDUMP (" it is hidden buffer struct arg\n " );
3176
- assert (varDsc->IsHiddenBufferStructArg ());
3177
3178
break ;
3178
3179
case DoNotEnregisterReason::DontEnregStructs:
3179
3180
JITDUMP (" struct enregistration is disabled\n " );
You can’t perform that action at this time.
0 commit comments