File tree 4 files changed +90
-3
lines changed
tests/JIT/Regression/JitBlue/Runtime_91839
4 files changed +90
-3
lines changed Original file line number Diff line number Diff line change @@ -3516,6 +3516,11 @@ struct GenTreeLclVarCommon : public GenTreeUnOp
3516
3516
return m_ssaNum.IsComposite ();
3517
3517
}
3518
3518
3519
+ bool HasSsaIdentity () const
3520
+ {
3521
+ return !m_ssaNum.IsInvalid ();
3522
+ }
3523
+
3519
3524
#if DEBUGGABLE_GENTREE
3520
3525
GenTreeLclVarCommon () : GenTreeUnOp()
3521
3526
{
Original file line number Diff line number Diff line change @@ -750,9 +750,10 @@ void MorphCopyBlockHelper::MorphStructCases()
750
750
}
751
751
}
752
752
753
- // Check to see if we are doing a copy to/from the same local block.
754
- // If so, morph it to a nop.
755
- if ((m_dstVarDsc != nullptr ) && (m_srcVarDsc == m_dstVarDsc) && (m_dstLclOffset == m_srcLclOffset))
753
+ // Check to see if we are doing a copy to/from the same local block. If so, morph it to a nop.
754
+ // Don't do this for SSA definitions as we have no way to update downstream uses.
755
+ if ((m_dstVarDsc != nullptr ) && (m_srcVarDsc == m_dstVarDsc) && (m_dstLclOffset == m_srcLclOffset) &&
756
+ !m_store->AsLclVarCommon ()->HasSsaIdentity ())
756
757
{
757
758
JITDUMP (" Self-copy; replaced with a NOP.\n " );
758
759
m_transformationDecision = BlockTransformation::Nop;
Original file line number Diff line number Diff line change
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
+ public class Runtime_91839
8
+ {
9
+ public static I0 [ ] s_1 ;
10
+ public static I2 s_5 ;
11
+
12
+ [ Fact ]
13
+ public static void TestEntryPoint ( )
14
+ {
15
+ S1 vr2 = new S1 ( new S0 ( 0 ) ) ;
16
+ if ( vr2 . F5 )
17
+ {
18
+ s_5 = s_5 ;
19
+ }
20
+
21
+ S1 vr3 = vr2 ;
22
+ vr3 . F4 = vr3 . F4 ;
23
+ for ( int vr4 = 0 ; vr4 < 1 ; vr4 ++ )
24
+ {
25
+ var vr5 = vr3 . F4 ;
26
+ M2 ( vr5 ) ;
27
+ }
28
+
29
+ Assert . True ( vr3 . F4 . F2 == 0 ) ;
30
+ }
31
+
32
+ private static void M2 ( S0 arg0 )
33
+ {
34
+ s_1 = new I0 [ ] { new C0 ( ) } ;
35
+ }
36
+
37
+ public interface I0
38
+ {
39
+ }
40
+
41
+ public interface I2
42
+ {
43
+ }
44
+
45
+ public struct S0
46
+ {
47
+ public ulong F0 ;
48
+ public long F2 ;
49
+ public short F3 ;
50
+ public S0 ( long f2 ) : this ( )
51
+ {
52
+ F2 = f2 ;
53
+ }
54
+ }
55
+
56
+ public class C0 : I0
57
+ {
58
+ }
59
+
60
+ public struct S1
61
+ {
62
+ public S0 F4 ;
63
+ public bool F5 ;
64
+ public S1 ( S0 f4 ) : this ( )
65
+ {
66
+ F4 = f4 ;
67
+ }
68
+ }
69
+ }
Original file line number Diff line number Diff line change
1
+ <Project Sdk =" Microsoft.NET.Sdk" >
2
+ <PropertyGroup >
3
+ <Optimize >True</Optimize >
4
+
5
+ <!-- Needed for CLRTestEnvironmentVariable -->
6
+ <RequiresProcessIsolation >true</RequiresProcessIsolation >
7
+ </PropertyGroup >
8
+ <ItemGroup >
9
+ <Compile Include =" $(MSBuildProjectName).cs" />
10
+ <CLRTestEnvironmentVariable Include =" DOTNET_JitStressModeNames" Value =" STRESS_NO_OLD_PROMOTION" />
11
+ </ItemGroup >
12
+ </Project >
You can’t perform that action at this time.
0 commit comments