Open PavelCibulka opened 3 months ago
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch See info in area-owners.md if you want to be subscribed.
The fundamental problem here is the same as in #11992, #89374, #91517, #93105, #96372. Related comment: https://github.com/dotnet/runtime/issues/96372#issuecomment-1875089781
When modifying immutable struct (by creating new one and coppying everything except some fields) generated code contains unnecessary instructions.
Examples (.Net 8) Immutable struct code:
generated code for SetTsol function (https://godbolt.org/ .NET 8.0)
There are three pairs (six) of unnecessary instructions that just cancel each other, in this example. Complier should generate same code as for mutable code. Example:
generated code for SetTsol function (https://godbolt.org/ .NET 8.0)