}
GenTree* stubAddr = impRuntimeLookupToTree(pResolvedToken, &callInfo->stubLookup, methHnd);
- assert(!compDonotInline());
+
+ // stubAddr tree may require a new temp.
+ // If we're inlining, this may trigger the too many locals inline failure.
+ //
+ // If so, we need to bail out.
+ //
+ if (compDonotInline())
+ {
+ return TYP_UNDEF;
+ }
// This is the rough code to set up an indirect stub call
assert(stubAddr != nullptr);
// The stubAddr may be a
// complex expression. As it is evaluated after the args,
// it may cause registered args to be spilled. Simply spill it.
+ //
+ unsigned const lclNum = lvaGrabTemp(true DEBUGARG("VirtualCall with runtime lookup"));
+ if (compDonotInline())
+ {
+ return TYP_UNDEF;
+ }
- unsigned lclNum = lvaGrabTemp(true DEBUGARG("VirtualCall with runtime lookup"));
impAssignTempGen(lclNum, stubAddr, (unsigned)CHECK_SPILL_NONE);
stubAddr = gtNewLclvNode(lclNum, TYP_I_IMPL);