From: Egor Bogatov Date: Mon, 7 Mar 2022 08:53:34 +0000 (+0300) Subject: Fix address exposure + fsub (#66253) X-Git-Tag: accepted/tizen/unified/riscv/20231226.055536~10476 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b1da321d184875040bd6aa8c5ebd904e8192815f;p=platform%2Fupstream%2Fdotnet%2Fruntime.git Fix address exposure + fsub (#66253) --- diff --git a/src/coreclr/jit/forwardsub.cpp b/src/coreclr/jit/forwardsub.cpp index c14cbf7..0492f0e 100644 --- a/src/coreclr/jit/forwardsub.cpp +++ b/src/coreclr/jit/forwardsub.cpp @@ -636,7 +636,7 @@ bool Compiler::fgForwardSubStatement(Statement* stmt) // If fwdSubNode is an address-exposed local, forwarding it may lose optimizations. // (maybe similar for dner?) // - if (fwdSubNode->OperIs(GT_LCL_VAR)) + if (fwdSubNode->IsLocal()) { unsigned const fwdLclNum = fwdSubNode->AsLclVarCommon()->GetLclNum(); LclVarDsc* const fwdVarDsc = lvaGetDesc(fwdLclNum); diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_66242/Runtime_66242.cs b/src/tests/JIT/Regression/JitBlue/Runtime_66242/Runtime_66242.cs new file mode 100644 index 0000000..bec4dd0 --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_66242/Runtime_66242.cs @@ -0,0 +1,43 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +// Generated by Fuzzlyn v1.5 on 2022-02-27 18:35:07 +// Run on X86 Windows +// Seed: 14567735315501116995 +// Reduced from 12.1 KiB to 0.5 KiB in 00:01:37 +// Debug: Outputs 2 +// Release: Outputs 1 + +using System.Runtime.CompilerServices; + +public struct S0 +{ + public ulong F1; +} + +public struct S1 +{ + public S0 F6; +} + +public class Runtime_66242 +{ + public static short s_3; + public static int Main() + { + var vr3 = new S1(); + if (vr3.F6.F1 < M4(ref vr3)) + { + int vr9 = s_3++; + } + + return s_3 + 98; + } + + public static uint M4(ref S1 arg1) + { + int var0 = s_3++; + arg1.F6.F1 = 16700531892663534200UL; + return 1; + } +} diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_66242/Runtime_66242.csproj b/src/tests/JIT/Regression/JitBlue/Runtime_66242/Runtime_66242.csproj new file mode 100644 index 0000000..f492aea --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_66242/Runtime_66242.csproj @@ -0,0 +1,9 @@ + + + Exe + True + + + + + \ No newline at end of file