Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
7 changes: 7 additions & 0 deletions src/coreclr/jit/assertionprop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4699,6 +4699,13 @@ GenTree* Compiler::optAssertionPropLocal_RelOp(ASSERT_VALARG_TP assertions, GenT

// Find an equal or not equal assertion about op1 var.
unsigned lclNum = op1->AsLclVarCommon()->GetLclNum();

// Make sure we operate on a local of the right type.
if (!op1->TypeIs(lvaGetRealType(lclNum)))
{
return nullptr;
}

noway_assert(lclNum < lvaCount);
AssertionIndex index = optLocalAssertionIsEqualOrNotEqual(op1Kind, lclNum, op2Kind, cnsVal, assertions);

Expand Down
27 changes: 27 additions & 0 deletions src/tests/JIT/Regression/JitBlue/Runtime_119654/Runtime_119654.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// 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 System.Runtime.CompilerServices;
using Xunit;

public class Runtime_119654
{
[Fact]
public static void TestEntryPoint()
{
if (ShouldReturnOne(-4294967296L) != 1)
{
throw new Exception("Test failed");
}
}

[MethodImpl(MethodImplOptions.NoInlining |
MethodImplOptions.AggressiveOptimization)]
private static int ShouldReturnOne(long availableSigned)
{
if (availableSigned == 0L)
return 0;
return (uint)(ulong)availableSigned != 0 ? 111 : 1;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<DebugType>None</DebugType>
<Optimize>True</Optimize>
</PropertyGroup>
<ItemGroup>
<Compile Include="$(MSBuildProjectName).cs" />
</ItemGroup>
</Project>
Loading