dotnet / runtime

.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
https://docs.microsoft.com/dotnet/core/
MIT License
15.34k stars 4.74k forks source link

JIT: `GetFfr` hw intrinsics are not modelled appropriately by value numbering #105944

Closed jakobbotsch closed 3 months ago

jakobbotsch commented 3 months ago

These are nullary HW intrinsics that read from state that we do not model. VN should be giving them new unique VNs to model this. Right now I would expect two GetFfr calls to be CSE'd regardless of interfering intrinsics that may redefine ffr.

cc @dotnet/jit-contrib @dotnet/arm64-contrib

dotnet-policy-service[bot] commented 3 months ago

Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch See info in area-owners.md if you want to be subscribed.

jakobbotsch commented 3 months ago

Simplest fix is probably just to add it next to the existing case: https://github.com/dotnet/runtime/blob/6931b3b729ec050f935f958122d3cc66bb46fdcf/src/coreclr/jit/valuenum.cpp#L13059-L13068

jakobbotsch commented 3 months ago

Although, it seems cleaner to give it HW_Flag_SpecialSideEffect_Other and then teach VN that it should always give HW intrinsics with that flag unique VNs. Let me try opening a PR with that change.