-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Closed
Labels
area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMICLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
Milestone
Description
in pull request #121697, I'm seeing this line:
runtime/src/tests/JIT/Intrinsics/TypeEqualitySealed.cs
Lines 41 to 42 in 73c8ac2
| [MethodImpl(MethodImplOptions.NoInlining)] | |
| public static object TestTernary8(SealedClass1 instance) => instance.GetType() == typeof(SealedClass2) ? "Fail" : "Ok"; |
Optimized to:
00007FF63D852FF0 lea rax,[__Str_Ok (07FF63D88B278h)]
00007FF63D852FF7 ret
What is probably happening is that with trimming disabled, whole program analysis sees SealedClass2 as possible (because we reflection-rooted it), however after allowing trimming, it becomes impossible and we forget about the NRE side effect.
To repro, you can just copy paste the C# source into the Visual Studio repro project and add -O to the ILC command line. Delete the Xunit gunk and rename the Fact method to Main.
Cc @EgorBo
EgorBo
Metadata
Metadata
Assignees
Labels
area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMICLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI