Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions src/mono/mono/mini/method-to-ir.c
Original file line number Diff line number Diff line change
Expand Up @@ -9792,12 +9792,11 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
// callvirt instance ISomeIface::Method()
// TO
// call SomeStruct::Method()
guchar* callvirt_ip;
guint32 callvirt_proc_token;
if (!((cfg->compile_aot || cfg->compile_llvm) && !mono_class_is_def(klass)) && // we cannot devirtualize in AOT when using generics
next_ip < end &&
(callvirt_ip = il_read_callvirt (next_ip, end, &callvirt_proc_token)) &&
ip_in_bb (cfg, cfg->cbb, callvirt_ip) ) {
il_read_callvirt (next_ip, end, &callvirt_proc_token) &&
ip_in_bb (cfg, cfg->cbb, next_ip) ) {
MonoMethod* iface_method;
MonoMethodSignature* iface_method_sig;

Expand Down
16 changes: 16 additions & 0 deletions src/tests/JIT/Regression/JitBlue/Runtime_95347/Runtime_95347.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System;
using Xunit;

public static class Runtime_95347
{
[Fact]
public static int Test()
{
object? n = "abcd";
var s = (n ?? false).ToString();
return (s == "abcd") ? 100 : -1;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Optimize>True</Optimize>
</PropertyGroup>
<ItemGroup>
<Compile Include="$(MSBuildProjectName).cs" />
</ItemGroup>
</Project>