@@ -6609,7 +6609,27 @@ void Compiler::verHandleVerificationFailure(BasicBlock* block DEBUGARG(bool logM
66096609#endif // DEBUG
66106610}
66116611
6612- /******************************************************************************/
6612+ typeInfo Compiler::verMakeTypeInfoForLocal(unsigned lclNum)
6613+ {
6614+ LclVarDsc* varDsc = lvaGetDesc(lclNum);
6615+
6616+ if ((varDsc->TypeGet() == TYP_BLK) || (varDsc->TypeGet() == TYP_LCLBLK))
6617+ {
6618+ return typeInfo();
6619+ }
6620+ if (varDsc->TypeGet() == TYP_BYREF)
6621+ {
6622+ // Pretend all byrefs are pointing to bytes.
6623+ return typeInfo(TI_BYTE).MakeByRef();
6624+ }
6625+ if (varTypeIsStruct(varDsc))
6626+ {
6627+ return typeInfo(TI_STRUCT, varDsc->GetStructHnd());
6628+ }
6629+
6630+ return typeInfo(varDsc->TypeGet());
6631+ }
6632+
66136633typeInfo Compiler::verMakeTypeInfo(CorInfoType ciType, CORINFO_CLASS_HANDLE clsHnd)
66146634{
66156635 assert(ciType < CORINFO_TYPE_COUNT);
@@ -10770,9 +10790,9 @@ var_types Compiler::impImportCall(OPCODE opcode,
1077010790 assert(IsTargetAbi(CORINFO_NATIVEAOT_ABI));
1077110791 if (call->OperGet() != GT_LCL_VAR) // can be already converted by impFixupCallStructReturn.
1077210792 {
10773- unsigned calliSlot = lvaGrabTemp(true DEBUGARG("calli"));
10774- LclVarDsc* varDsc = lvaGetDesc(calliSlot);
10775- varDsc->lvVerTypeInfo = tiRetVal;
10793+ unsigned calliSlot = lvaGrabTemp(true DEBUGARG("calli"));
10794+ LclVarDsc* varDsc = lvaGetDesc(calliSlot);
10795+
1077610796 impAssignTempGen(calliSlot, call, tiRetVal.GetClassHandle(), (unsigned)CHECK_SPILL_NONE);
1077710797 // impAssignTempGen can change src arg list and return type for call that returns struct.
1077810798 var_types type = genActualType(lvaTable[calliSlot].TypeGet());
@@ -13610,8 +13630,7 @@ void Compiler::impImportBlockCode(BasicBlock* block)
1361013630 // &aliasedVar doesnt need GTF_GLOB_REF, though alisasedVar does
1361113631 assert((op1->gtFlags & GTF_GLOB_REF) == 0);
1361213632
13613- tiRetVal = lvaTable[lclNum].lvVerTypeInfo;
13614-
13633+ tiRetVal = typeInfo(TI_BYTE).MakeByRef();
1361513634 impPushOnStack(op1, tiRetVal);
1361613635 break;
1361713636
@@ -17665,9 +17684,9 @@ GenTreeLclVar* Compiler::impCreateLocalNode(unsigned lclNum DEBUGARG(IL_OFFSET o
1766517684
1766617685// Load a local/argument on the operand stack
1766717686// lclNum is an index into lvaTable *NOT* the arg/lcl index in the IL
17668- void Compiler::impLoadVar(unsigned lclNum, IL_OFFSET offset, const typeInfo& tiRetVal )
17687+ void Compiler::impLoadVar(unsigned lclNum, IL_OFFSET offset)
1766917688{
17670- impPushVar(impCreateLocalNode(lclNum DEBUGARG(offset)), tiRetVal );
17689+ impPushVar(impCreateLocalNode(lclNum DEBUGARG(offset)), verMakeTypeInfoForLocal(lclNum) );
1767117690}
1767217691
1767317692// Load an argument on the operand stack
@@ -20743,11 +20762,6 @@ unsigned Compiler::impInlineFetchLocal(unsigned lclNum DEBUGARG(const char* reas
2074320762 {
2074420763 lvaSetStruct(tmpNum, inlineeLocal.lclVerTypeInfo.GetClassHandle(), true /* unsafe value cls check */);
2074520764 }
20746- else
20747- {
20748- // This is a wrapped primitive. Make sure the verstate knows that
20749- lvaTable[tmpNum].lvVerTypeInfo = inlineeLocal.lclVerTypeInfo;
20750- }
2075120765 }
2075220766
2075320767#ifdef DEBUG
@@ -20960,11 +20974,6 @@ GenTree* Compiler::impInlineFetchArg(unsigned lclNum, InlArgInfo* inlArgInfo, In
2096020974 lvaSetStructUsedAsVarArg(tmpNum);
2096120975 }
2096220976 }
20963- else
20964- {
20965- // This is a wrapped primitive. Make sure the verstate knows that
20966- lvaTable[tmpNum].lvVerTypeInfo = lclInfo.lclVerTypeInfo;
20967- }
2096820977 }
2096920978
2097020979 argInfo.argHasTmp = true;
0 commit comments