@@ -50,51 +50,17 @@ void Compiler::impPushOnStack(GenTree* tree, typeInfo ti)
5050// helper function that will tell us if the IL instruction at the addr passed
5151// by param consumes an address at the top of the stack. We use it to save
5252// us lvAddrTaken
53- bool Compiler::impILConsumesAddr(const BYTE* codeAddr)
53+ bool Compiler::impILConsumesAddr(var_types typ, const BYTE* codeAddr, const BYTE* codeEndp )
5454{
55- assert(!compIsForInlining());
56-
57- OPCODE opcode;
58-
59- opcode = (OPCODE)getU1LittleEndian(codeAddr);
60-
55+ OPCODE opcode = impGetNonPrefixOpcode(codeAddr, codeEndp);
6156 switch (opcode)
6257 {
63- // case CEE_LDFLDA: We're taking this one out as if you have a sequence
64- // like
65- //
66- // ldloca.0
67- // ldflda whatever
68- //
69- // of a primitivelike struct, you end up after morphing with addr of a local
70- // that's not marked as addrtaken, which is wrong. Also ldflda is usually used
71- // for structs that contain other structs, which isnt a case we handle very
72- // well now for other reasons.
73-
7458 case CEE_LDFLD:
7559 {
76- // We won't collapse small fields. This is probably not the right place to have this
77- // check, but we're only using the function for this purpose, and is easy to factor
78- // out if we need to do so.
79-
80- CORINFO_RESOLVED_TOKEN resolvedToken;
81- impResolveToken(codeAddr + sizeof(int8_t), &resolvedToken, CORINFO_TOKENKIND_Field);
82-
83- var_types lclTyp = JITtype2varType(info.compCompHnd->getFieldType(resolvedToken.hField));
84-
85- // Preserve 'small' int types
86- if (!varTypeIsSmall(lclTyp))
87- {
88- lclTyp = genActualType(lclTyp);
89- }
90-
91- if (varTypeIsSmall(lclTyp))
92- {
93- return false;
94- }
95-
96- return true;
60+ // addr followed by LDFLD for non-struct types
61+ return !varTypeIsStruct(typ);
9762 }
63+
9864 default:
9965 break;
10066 }
@@ -7062,9 +7028,7 @@ void Compiler::impImportBlockCode(BasicBlock* block)
70627028 return;
70637029 }
70647030
7065- op1->ChangeType(TYP_BYREF);
7066- op1->SetOper(GT_LCL_ADDR);
7067- op1->AsLclFld()->SetLclOffs(0);
7031+ op1 = gtNewLclAddrNode(op1->AsLclVar()->GetLclNum(), 0, TYP_BYREF);
70687032 goto _PUSH_ADRVAR;
70697033 }
70707034
0 commit comments