@@ -1500,14 +1500,6 @@ GenTree* CallArgs::MakeTmpArgNode(Compiler* comp, CallArg* arg)
15001500 {
15011501 // We are passing this struct by value in multiple registers and/or on stack.
15021502 argNode = comp->gtNewLclvNode(lclNum, argType);
1503-
1504- #ifndef TARGET_XARCH
1505- // ARM/ARM64/LoongArch64 backends do not support LCL_VARs as sources of some stack args.
1506- // Wrap it in an "OBJ(ADDR(...))". TODO-ADDR: delete this code once all backends support
1507- // LCL_VAR stack args.
1508- argNode = comp->gtNewOperNode(GT_ADDR, TYP_BYREF, argNode);
1509- argNode = comp->gtNewObjNode(varDsc->GetLayout(), argNode);
1510- #endif // !TARGET_XARCH
15111503 }
15121504 }
15131505 else
@@ -3694,35 +3686,18 @@ GenTree* Compiler::fgMorphMultiregStructArg(CallArg* arg)
36943686 {
36953687 lcl = actualArg->AsLclVar();
36963688 }
3697- if (lcl != nullptr)
3689+ if (( lcl != nullptr) && (lvaGetPromotionType(lcl->GetLclNum()) == PROMOTION_TYPE_INDEPENDENT) )
36983690 {
3699- if (lvaGetPromotionType(lcl->GetLclNum()) == PROMOTION_TYPE_INDEPENDENT)
3691+ if (argNode->OperIs(GT_LCL_VAR) ||
3692+ ClassLayout::AreCompatible(argNode->AsObj()->GetLayout(), lvaGetDesc(lcl)->GetLayout()))
37003693 {
3701- if (argNode->OperIs(GT_LCL_VAR) ||
3702- ClassLayout::AreCompatible(argNode->AsObj()->GetLayout(), lvaGetDesc(lcl)->GetLayout()))
3703- {
3704- argNode = fgMorphLclArgToFieldlist(lcl);
3705- }
3706- else
3707- {
3708- // Set DNER to block independent promotion.
3709- lvaSetVarDoNotEnregister(lcl->GetLclNum() DEBUGARG(DoNotEnregisterReason::IsStructArg));
3710- }
3694+ argNode = fgMorphLclArgToFieldlist(lcl);
37113695 }
3712- #ifdef TARGET_LOONGARCH64
3713- else if (argNode->TypeGet() == TYP_STRUCT)
3696+ else
37143697 {
3715- // LoongArch64 backend does not support local nodes as sources of some stack args.
3716- if (!actualArg->OperIs(GT_OBJ))
3717- {
3718- // Create an Obj of the temp to use it as a call argument.
3719- argNode = gtNewOperNode(GT_ADDR, TYP_I_IMPL, argNode);
3720- argNode = gtNewObjNode(lvaGetStruct(lcl->GetLclNum()), argNode);
3721- }
3722- // Its fields will need to be accessed by address.
3698+ // Set DNER to block independent promotion.
37233699 lvaSetVarDoNotEnregister(lcl->GetLclNum() DEBUGARG(DoNotEnregisterReason::IsStructArg));
37243700 }
3725- #endif // TARGET_LOONGARCH64
37263701 }
37273702
37283703 return argNode;
0 commit comments