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
6 changes: 0 additions & 6 deletions src/coreclr/jit/valuenum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2575,12 +2575,6 @@ ValueNum ValueNumStore::VNForFunc(var_types typ, VNFunc func, ValueNum arg0VN)
{
*resultVN = funcApp.GetArg(0);
}
// NOT(relop(x,y)) ==> Reverse(relop)(x,y)
//
else if (VNFuncIsComparison(funcApp.GetFunc()))
{
*resultVN = GetRelatedRelop(arg0VN, VN_RELATION_KIND::VRK_Reverse);
}
}
}

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

// VN was simplifying NOT(relop(x,y)) to Reverse(relop)(x,y). GT_NOT is
// bitwise complement, not logical negation: ~(x relop y) produces -1 or
// -2 for a 0/1 relop result, while Reverse(relop)(x,y) produces 0 or 1,
// so downstream uses comparing the value arithmetically (here `~v3 >= -1`)
// folded the wrong way.

namespace Runtime_129076;

using System.Runtime.CompilerServices;
using Xunit;

public static class Runtime_129076
{
private static volatile int Input_p0 = unchecked((int)0x800335C5);
private static volatile int Input_p1 = 0;

[MethodImpl(MethodImplOptions.NoInlining)]
public static int Func(int p0, int p1)
{
unchecked
{
int v1 = unchecked((int)0x000335C5) & p1;
int v3 = (v1 != p0) ? 1 : 0;
if (v3 == 0) return 99;
int v4 = ~v3;
return (v4 >= -1) ? 1 : 0;
}
}

[Fact]
public static int TestEntryPoint()
{
return Func(Input_p0, Input_p1) == 0 ? 100 : 1;
}
}
1 change: 1 addition & 0 deletions src/tests/JIT/Regression/Regression_ro_2.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@
<Compile Include="JitBlue\Runtime_127446\Runtime_127446.cs" />
<Compile Include="JitBlue\Runtime_128631\Runtime_128631.cs" />
<Compile Include="JitBlue\Runtime_128801\Runtime_128801.cs" />
<Compile Include="JitBlue\Runtime_129076\Runtime_129076.cs" />
</ItemGroup>
<Import Project="$(TestSourceDir)MergedTestRunner.targets" />
</Project>
Loading