-
Notifications
You must be signed in to change notification settings - Fork 2k
Expand file tree
/
Copy pathTest.cs
More file actions
119 lines (109 loc) · 1.9 KB
/
Test.cs
File metadata and controls
119 lines (109 loc) · 1.9 KB
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
class Test
{
int field;
int f(int param1, System.Collections.Generic.IEnumerable<int> param2)
{
field = 3;
int x = 1;
int y;
int z;
if (param1 > 2)
{
x++;
y = ++x;
z = 3;
}
else
{
y = 2;
y += 4;
field = 10;
z = 4;
}
use(z);
while (x < y)
{
if (param1++ > 4)
{
break;
}
y -= 1;
}
use(field);
for (int i = 0; i < 10; i++)
{
x += i;
}
;
foreach (var w in param2)
{
param1 += w;
}
return x + y;
}
void g(int @in, out int @out)
{
if (@in > 0)
{
@out = 0;
}
else
{
@out = 1;
}
use(field);
field = 2;
use(field);
return;
}
void h(int x)
{
try
{
var temp = 0 / x;
}
catch (System.DivideByZeroException e)
{
use(e);
}
}
void use<T>(T x) { }
void phiReads(bool b1, bool b2, bool b3, bool b4, bool b5, bool b6)
{
var x = 0;
if (b1)
{
use(x);
}
else if (b2)
{
use(x);
}
// phi_use for `x`
if (b3)
{
use(x);
}
else if (b4)
{
use(x);
}
// phi_use for `x`, even though there is an actual use in the block
use(x);
if (b5)
{
use(x);
}
else
{
x = 1;
use(x);
}
// no phi_use (normal phi instead)
if (b6)
{
use(x);
}
// no phi_use for `x`, because not live
}
}