You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Analyzer Proposal]: Remove redundant cast on vectors #103557
Strong typing for SIMD often leads to frequent casts from one type of Vector to another (typically, no-op in codegen). Sometimes user might accidentally introduce redundant casts that can be safely removed. I propose an analyzer that highlights such casts. Example:
Here I had to insert quite a few casts to make it work as expected and it's not obvious whether some of them might be redundant or not. It's not a codegen issue, just an opportunity to make code smaller = easier to read.
API Usage
Vector128<ulong>v=Vector128.Create(ulong.MaxValue);DoWork(v.AsUInt64());// Flagged with "redundant cast"
Notably this is always a no-op, it's fully elided in importation and never produces IR today (barring the case we throw because it is invalid, but that's also statically determined).
We can likely just close this and lump it together with the already approved: #82488, which tracks a general analyzer for suggesting more optimal SIMD patterns.
Activity
EgorBo commentedon Jun 17, 2024
cc @tannergooding
dotnet-policy-service commentedon Jun 17, 2024
Tagging subscribers to this area: @dotnet/area-system-numerics
See info in area-owners.md if you want to be subscribed.
tannergooding commentedon Jun 17, 2024
Notably this is always a no-op, it's fully elided in importation and never produces IR today (barring the case we throw because it is invalid, but that's also statically determined).
We can likely just close this and lump it together with the already approved: #82488, which tracks a general analyzer for suggesting more optimal SIMD patterns.