Inliner: fix assert for multiple failure reasons when inlining
Change dotnet/coreclr#3436 added asserts that checked that the LegacyPolicy would not
see multiple failing observations when inlining because we expect the
inliner to fail fast when it hits the first bad observation.
This change adds a test case that shows one example where we could get
two failing observations, along with code changes to fix the issue.
When an inlinee has invalid IL, an exception is raised and caught in
`jitNativeCode`. The catch there sets the inline result to the never
state. A failure code is propagated back to `fgInvokeInlineeCompiler`
which redundantly sets the inline result to a failing state with a
generic "something bad happened" observation. This second observation
triggers an assert since the jit is inlining and the result is already
known to be a failure.
The fix is to check in `fgInvokeInlineeCompiler` if the inline result
is already known to be in a failing state, and if so, forgo the new
observation.
Commit migrated from https://github.com/dotnet/coreclr/commit/
eec9185b2257e8810d8e2af1a4bc41a05cdf51b6