JIT: Fix noway_assert when inlining
The jit keeps track of which inline arguments can be modified via starg
during the inlinee IL prescan to ensure that a temp is used to represent
such arguments in the inlined body. There is a noway_assert the a starg
is procecssed during importation that double-checks that a temp is really
being used, and this assert was firing.
The prescan guraded the starg tracking with a check to avoid an out-of-bounds
write into the argument table when scanning bad IL with bogus argument numbers.
The predicate was checking the argument number against lvaTableCount.
Unfortunately for inlinees this value is not related to the number of arguments.
In particular it some rare cases it may be an underestimate so the prescan might
end up failing to note a starg. If the the jit then tries to inline and the
caller passes a constant, the assert will then fire.
Fix is to update the guard to use the number of callee arguments. This is
known to be less than the table size by earlier checks.
Added a test case.
Closes dotnet/coreclr#9891.
Commit migrated from https://github.com/dotnet/coreclr/commit/
0380bad51faf5ef608208f1ead8294dcf8519ce0