Open oleg-st opened 8 months ago
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch See info in area-owners.md if you want to be subscribed.
It's expected currently as pointers are always considered as address-exposed. I wonder if maybe such unnecessary address exposure can be eliminated by the JIT in the future.
This is not expected. There should be no difference in codegen here -- we end up with a cast on top of an IR node taking the address of the local (already questionable as such casts essentially are no-ops in the JIT), and it blocks a bunch of optimizations.
Won't get to this CQ enhancement in .NET 9, sadly.
Description
I have code ported from C that contains passing arguments by pointers, I noticed that if I replace them with passing by reference, it can improve codegeneration.
Code:
Test1:
Test2:
SharpLab
Configuration
.NET 8.0.202