From f5bee7d646dc2b2ee185c4862be6076ac0b7d773 Mon Sep 17 00:00:00 2001 From: Hongtao Yu Date: Mon, 11 Jan 2016 15:24:49 -0800 Subject: Fix for bug 2610 Incorrect copy prop substitution. The bug is due to missing lvAddrExposed flag for tmp vars serving as pass-by-ref arguments. --- .../Regression/JitBlue/GitHub_2610/GitHub_2610.cs | 78 ++++++++++++++++++++++ .../JitBlue/GitHub_2610/GitHub_2610.csproj | 50 ++++++++++++++ .../JIT/Regression/JitBlue/GitHub_2610/app.config | 27 ++++++++ 3 files changed, 155 insertions(+) create mode 100644 tests/src/JIT/Regression/JitBlue/GitHub_2610/GitHub_2610.cs create mode 100644 tests/src/JIT/Regression/JitBlue/GitHub_2610/GitHub_2610.csproj create mode 100644 tests/src/JIT/Regression/JitBlue/GitHub_2610/app.config (limited to 'tests') diff --git a/tests/src/JIT/Regression/JitBlue/GitHub_2610/GitHub_2610.cs b/tests/src/JIT/Regression/JitBlue/GitHub_2610/GitHub_2610.cs new file mode 100644 index 0000000000..fb7559e4ec --- /dev/null +++ b/tests/src/JIT/Regression/JitBlue/GitHub_2610/GitHub_2610.cs @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System; +using System.Runtime.CompilerServices; + +public struct MyValue +{ + public long val; + public MyValue(long a) + { val = a; } +} + +public struct MyStruct +{ + public MyValue v1; + public MyValue v2; + + public MyStruct(MyValue a, MyValue b) + { v1 = a; v2 = b; } +} + +class Program +{ + static int Main() + { + MyValue p1 = new MyValue(10); + MyValue p2 = new MyValue(20); + + MyStruct c1 = new MyStruct(p1, p2); + MyStruct c2 = new MyStruct(p2, p1); + + bool b1 = Program.IsXGeater(c1); + bool b2 = Program.IsXGeater(c2); + bool b3 = Program.IsXGeater(c1); + bool b4 = Program.IsXGeater(c2); + + if (b1) + { + Console.WriteLine("Fail"); + return -1; + } + + if (!b2) + { + Console.WriteLine("Fail"); + return -1; + } + + if (b3) + { + Console.WriteLine("Fail"); + return -1; + } + + if (!b4) + { + Console.WriteLine("Fail"); + return -1; + } + + Console.WriteLine("Pass"); + return 100; + } + + // Return true if p1.x > p2.y + [MethodImplAttribute(MethodImplOptions.NoInlining)] + public static bool IsXGeater(MyStruct line) + { + if (line.v1.val > line.v2.val) + { + line = new MyStruct(line.v2, line.v1); + return true; + } + + return false; + } +} diff --git a/tests/src/JIT/Regression/JitBlue/GitHub_2610/GitHub_2610.csproj b/tests/src/JIT/Regression/JitBlue/GitHub_2610/GitHub_2610.csproj new file mode 100644 index 0000000000..8f33be95db --- /dev/null +++ b/tests/src/JIT/Regression/JitBlue/GitHub_2610/GitHub_2610.csproj @@ -0,0 +1,50 @@ + + + + + Debug + AnyCPU + $(MSBuildProjectName) + 2.0 + {95DFC527-4DC1-495E-97D7-E94EE1F7140D} + Exe + Properties + 512 + {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + $(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages + ..\..\ + + 7a9bfb7d + + + + + + + + + False + + + + + True + + + + + + + + + + + + + $(JitPackagesConfigFileDirectory)minimal\project.json + $(JitPackagesConfigFileDirectory)minimal\project.lock.json + + + + + diff --git a/tests/src/JIT/Regression/JitBlue/GitHub_2610/app.config b/tests/src/JIT/Regression/JitBlue/GitHub_2610/app.config new file mode 100644 index 0000000000..62803f5972 --- /dev/null +++ b/tests/src/JIT/Regression/JitBlue/GitHub_2610/app.config @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file -- cgit v1.2.3