blob: f0f96f0f657ec25168c0b20f9e790965283897f5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
using System;
using Mono.Linker.Tests.Cases.Expectations.Assertions;
using Mono.Linker.Tests.Cases.Expectations.Metadata;
namespace Mono.Linker.Tests.Cases.UnreachableBlock
{
[SetupCSharpCompilerToUse ("csc")]
[SetupCompileArgument ("/optimize+")]
[SetupLinkerArgument ("--enable-opt", "ipconstprop")]
public class DeadVariables
{
public static void Main ()
{
Test_1 ();
Test_2 (4);
Test_3 ();
}
[Kept]
[ExpectBodyModified]
[ExpectedLocalsSequence (new string [0])]
static void Test_1 ()
{
if (!AlwaysTrue) {
int var = 1;
Console.WriteLine (var);
}
}
[Kept]
[ExpectBodyModified]
[ExpectedLocalsSequence (new string [] { "System.Object", "System.Int32" })]
static int Test_2 (int arg)
{
if (!AlwaysTrue) {
long var = 3;
Console.WriteLine (var++);
return (int) var;
}
{
int b = arg;
Console.WriteLine (b++);
return b;
}
}
[Kept]
[ExpectBodyModified]
[ExpectedLocalsSequence (new string [] { "System.Int32", "System.DateTime", "System.DateTimeOffset", "System.DateTimeOffset" })]
static int Test_3 ()
{
var b = 3;
var c = new DateTime ();
var d = new DateTimeOffset ();
var e = new DateTimeOffset ();
if (!AlwaysTrue) {
int a = b;
ref int var = ref a;
}
Console.WriteLine (b.ToString (), c, d, e);
return 2;
}
[Kept]
static bool AlwaysTrue {
[Kept]
get {
return true;
}
}
}
}
|