Skip to content

Commit f077de0

Browse files
authored
JIT: add ssa accounting to morph's div opts (#85332)
RBO triggered a morph opt that cloned an SSA local, throwing off the SSA accounting. Fix by invoking the accounting helper after the morph expansion. Closes #85226.
1 parent 2802c97 commit f077de0

File tree

3 files changed

+46
-0
lines changed

3 files changed

+46
-0
lines changed

src/coreclr/jit/morph.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12152,6 +12152,8 @@ GenTree* Compiler::fgMorphModToSubMulDiv(GenTreeOp* tree)
1215212152
result->gtDebugFlags |= GTF_DEBUG_NODE_MORPHED;
1215312153
#endif
1215412154

12155+
optRecordSsaUses(result, compCurBB);
12156+
1215512157
div->CheckDivideByConstOptimized(this);
1215612158

1215712159
return result;
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
4+
using System;
5+
using Xunit;
6+
7+
// Generated by Fuzzlyn v1.5 on 2023-04-23 17:14:26
8+
// Run on X64 Windows
9+
// Seed: 11244895947685014560
10+
// Reduced from 7.8 KiB to 0.3 KiB in 00:00:41
11+
// Hits JIT assert in Release:
12+
// Assertion failed '!"SSA check failures"' in 'Program:M1()' during 'Redundant branch opts' (IL size 29; hash 0xaf510bb6; FullOpts)
13+
//
14+
// File: D:\a\_work\1\s\src\coreclr\jit\fgdiagnostic.cpp Line: 4392
15+
//
16+
public class Runtime_85226
17+
{
18+
[Fact]
19+
public static int Test()
20+
{
21+
M1();
22+
return 100;
23+
}
24+
25+
private static void M1()
26+
{
27+
for (int var0 = 0; var0 < -1; var0++)
28+
{
29+
short var1 = 2;
30+
if (((ushort)((var0 % (var1 | 1)) % 0) < 0UL))
31+
{
32+
return;
33+
}
34+
}
35+
}
36+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
<PropertyGroup>
3+
<Optimize>True</Optimize>
4+
</PropertyGroup>
5+
<ItemGroup>
6+
<Compile Include="$(MSBuildProjectName).cs" />
7+
</ItemGroup>
8+
</Project>

0 commit comments

Comments
 (0)