Uh oh!
There was an error while loading. Please reload this page.
Fix fgValueNumberArrIndexVal for wide reads - #58309
Conversation
ghost
commented
Aug 28, 2021
Tagging subscribers to this area: @JulieLeeMSFT Issue DetailsMinimal repro: privatestaticboolTest1(){byte[]array=newbyte[2];array[0]=1;array[1]=2;bytea1=Unsafe.ReadUnaligned<byte>(refarray[0]);shorta2=Unsafe.ReadUnaligned<short>(refarray[0]);array[1]=42;shorta3=Unsafe.ReadUnaligned<short>(refarray[0]);returna1==a2&&a1==a3;}
The fix is quite conservative - it treats such array element loads as "non-proper" and assign a unique VN. PS: Doesn't reproduce on .NET 5.0 /cc @dotnet/jit-contrib
|
Heh, so I always wondered if it is possible to make VN use privatestaticfloatBitcast(){int[]array=newint[2];array[0]=1;returnUnsafe.ReadUnaligned<float>(refUnsafe.As<int,byte>(refarray[0]));} wholeElem $41 is MapSelect(hAtArrTypeAtArr($340), ind=$142).
VNForCastOper(float) is $42VNForCast($41, $42) returns $440 {FltCns[1.000000]}
selectedElem is $440 after applying selectors.But that is a separate issue (filed as #58312). |
EgorBo
commented
Aug 31, 2021
/backport to release/6.0 |
Started backporting to release/6.0: https://github.com/dotnet/runtime/actions/runs/1185769084 |
Fixes#57914
Minimal repro:
a1,a2anda3all have different values here with the same liberal VN resultingTest1to return true.a1:
a2:
(
$500here is$42with NullRefExc)a3:
The fix is quite conservative - it treats such array element loads as "non-proper" and assign a unique VN.
SuperPMI diffs are empty.
PS: Doesn't reproduce on .NET 5.0
/cc @dotnet/jit-contrib