[release/6.0] Fix VN incorrect optimizations with a new JitEEInterface function. (#58005)
* Add/return tests.
* improve the test naming.
* Add a new JitEE method.
with a naive implementation so far.
* Handle generically dissimilar type concerns as well as handle derived type case in the managed compiler
* Fix the field and Unsafe issues.
* fix some failures.
It appeared that we have many trees where we generate unique VN for rhs and don't inform `fgValueNumberBlockAssignment` about it.
For example, for
```
N005 ( 10, 8) [000033] -A--G---R--- * ASG struct (copy)
N004 ( 3, 2) [000031] D------N---- +--* LCL_VAR struct<eightByteStruct, 8> V01 loc1 d:2
N003 ( 6, 5) [000030] n---G------- \--* IND struct
N002 ( 3, 3) [000043] ------------ \--* ADDR byref
N001 ( 3, 2) [000044] -------N---- \--* LCL_VAR struct<largeStruct, 32> V00 loc0 u:6 (last use)
```
we will generate unique rhs but then `fgValueNumberBlockAssignment` will still try to work it as with a non-unique one.
* Fix an oooold bug in VN.
For a tree like:
```
N005 ( 11, 10) [001400] -A------R---- * ASG long
N004 ( 6, 5) [001401] *------N----- +--* IND long
N003 ( 3, 3) [001402] ------------- | \--* ADDR byref Zero Fseq[_00]
N002 ( 3, 2) [001403] U------N----- | \--* LCL_VAR struct<System.Runtime.Intrinsics.Vector128`1[Byte], 16> V45 tmp38 ud:3->4
N001 ( 1, 1) [001404] ------------- \--* LCL_VAR long V69 tmp62 u:2 (last use)
```
SSA was working correctly and printing that `001403` is using SSA-3 and defining SSA-4. However, this code, for some reason, was writing result as a define for SSA-3.
* Add new test cases and a fix for them.
* correct a test copy paste
* response review.
Co-authored-by: Sergey <seandree@microsoft.com>
Co-authored-by: David Wrighton <davidwr@microsoft.com>
33 files changed: