Skip to content

Fix compareTypesForEquality - #97062

Merged
jkotas merged 7 commits into
dotnet:mainfrom
jkotas:issue-96876
Jan 18, 2024
Merged

Fix compareTypesForEquality#97062
jkotas merged 7 commits into
dotnet:mainfrom
jkotas:issue-96876

Conversation

@jkotas

Copy link
Copy Markdown
Member

Fixes#96876

@ghostghost added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Jan 17, 2024
@ghostghost assigned jkotasJan 17, 2024
@ghost

Copy link
Copy Markdown

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

Issue Details

Fixes #96876

Author:jkotas
Assignees:-
Labels:

area-CodeGen-coreclr

Milestone:-

return true;
}

switch (et1)

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This improves the original implementation in addition to make it correct. For example, this can prove that KeyValuePair<__Canon, int> and KeyValuePair<int, __Canon> are never equal that the original implementation was not able to.

@EgorBo

Copy link
Copy Markdown
Member

@MihuBot

@JulieLeeMSFTJulieLeeMSFT added area-VM-coreclr and removed area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI labels Jan 17, 2024
@jkotas

Copy link
Copy Markdown
MemberAuthor

/azp run runtime-nativeaot-outerloop

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@jkotas

Copy link
Copy Markdown
MemberAuthor

/azp run runtime-nativeaot-outerloop

@jkotas
jkotas marked this pull request as ready for review January 18, 2024 00:00
@jkotas

Copy link
Copy Markdown
MemberAuthor

@MichalStrehovsky PTLA

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@jkotas

jkotas commented Jan 18, 2024

Copy link
Copy Markdown
MemberAuthor

This bug is not a recent regression for AOT compilers. The test introduced by this change fails with PublishAot and PublishReadyToRun in .NET 8. Any thoughts about whether the backport meets the bar?

@EgorBo

Copy link
Copy Markdown
Member

This bug is not a recent regression for AOT compilers. The test introduced by this change fails with PublishAot and PublishReadyToRun in .NET 8. Any thoughts about whether the backport meets the bar?

hm.. doesn't repro for me with R2R on net8.0, but does repro with NativeAOT

@jkotas

Copy link
Copy Markdown
MemberAuthor

hm.. doesn't repro for me with R2R on net8.0, but does repro with NativeAOT

Good catch. The pattern matching of typeof(X) == t.GetType() checks seems to be broken in R2R (you can take a look why is that).

The pattern matching of typeof(X) == typeof(Y) works well and hits the bug in .NET 8:

C:\repro>type Program.cs
using System.Runtime.CompilerServices;
public class Test96876
{
public static void Main()
{
Console.WriteLine(foo<string>());
}
[MethodImpl(MethodImplOptions.NoInlining)]
static bool foo<T>() => typeof(T[]) == typeof(string[]);
}
C:\repro>dotnet run
True
C:\repro>dotnet publish /p:PublishReadyToRun=true
MSBuild version 17.8.3+195e7f5a3 for .NET
Determining projects to restore...
Restored C:\repro\repro.csproj (in 174 ms).
repro -> C:\repro\bin\Release\net8.0\win-x64\repro.dll
repro -> C:\repro\bin\Release\net8.0\win-x64\publish\
C:\repro>C:\repro\bin\Release\net8.0\win-x64\publish\repro.exe
False
C:\repro>rmdir /s /q bin obj
C:\repro>dotnet publish /p:PublishAot=true
MSBuild version 17.8.3+195e7f5a3 for .NET
Determining projects to restore...
Restored C:\repro\repro.csproj (in 288 ms).
repro -> C:\repro\bin\Release\net8.0\win-x64\repro.dll
Generating native code
repro -> C:\repro\bin\Release\net8.0\win-x64\publish\
C:\repro>C:\repro\bin\Release\net8.0\win-x64\publish\repro.exe
False

@jkotas

Copy link
Copy Markdown
MemberAuthor

The pattern matching of typeof(X) == t.GetType() checks seems to be broken in R2R

Opened #97134

@jkotas

Copy link
Copy Markdown
MemberAuthor

/azp run runtime-nativeaot-outerloop

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

Comment threadsrc/coreclr/tools/Common/Compiler/TypeExtensions.cs
@MichalStrehovsky

Copy link
Copy Markdown
Member

This bug is not a recent regression for AOT compilers. The test introduced by this change fails with PublishAot and PublishReadyToRun in .NET 8. Any thoughts about whether the backport meets the bar?

We also shipped with it in .NET 7. Not a regression from previous release, no customer reports. Doesn't feel like we have a strong case for backport.

Comment threadsrc/tests/Regressions/coreclr/GitHub_96876/test96876.csproj Outdated
@jkotas
jkotas merged commit 5415bd2 into dotnet:mainJan 18, 2024
@jkotas
jkotas deleted the issue-96876 branch January 18, 2024 18:41
tmds pushed a commit to tmds/runtime that referenced this pull request Jan 23, 2024
@github-actionsgithub-actionsBot locked and limited conversation to collaborators Feb 18, 2024
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CollectionsMarshal.AsSpan assertion failure in System.Text.Json tests

4 participants

@jkotas@EgorBo@MichalStrehovsky@JulieLeeMSFT