Optimize modification of immutable struct #104209
Labels
area-CodeGen-coreclr
CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
tenet-performance
Performance related issue
Milestone
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)
The text was updated successfully, but these errors were encountered: