Fix bad cast morphing (dotnet/coreclr#13429)
fgMorphCast thinks that casting a i1 value to i2 via conv.ovf.i2.un is a widening conversion and removes the overflow check. But this is in fact a narrowing conversion because i1 is implicitly sign extended to i4 and then i4 is treated as u4. Going from i4 to u4 overflows for negative values so we can't treat the source type of the cast as i1, it has to be u4.
Of course, the existing code works fine if the source type is unsigned. Going from u1 to i4 and then to u4 never overflows so it's safe to treat the source type as u1.
Commit migrated from https://github.com/dotnet/coreclr/commit/
68e7669cf9cc6ad64fa0393339dbebafd03612e9