FIR CFG: merge DFA + CFA edge in Simple edge
This commit is contained in:
@@ -310,14 +310,14 @@ digraph flowFromInplaceLambda_kt {
|
|||||||
106 [label="Exit function test_4" style="filled" fillcolor=red];
|
106 [label="Exit function test_4" style="filled" fillcolor=red];
|
||||||
}
|
}
|
||||||
105 -> {107};
|
105 -> {107};
|
||||||
107 -> {108} [color=green];
|
107 -> {108};
|
||||||
107 -> {126} [color=red];
|
107 -> {126} [color=red];
|
||||||
108 -> {109};
|
108 -> {109};
|
||||||
109 -> {110};
|
109 -> {110};
|
||||||
110 -> {111};
|
110 -> {111};
|
||||||
111 -> {112};
|
111 -> {112};
|
||||||
112 -> {113};
|
112 -> {113};
|
||||||
113 -> {114} [color=green];
|
113 -> {114};
|
||||||
113 -> {132} [color=red];
|
113 -> {132} [color=red];
|
||||||
114 -> {115};
|
114 -> {115};
|
||||||
115 -> {116};
|
115 -> {116};
|
||||||
@@ -419,7 +419,7 @@ digraph flowFromInplaceLambda_kt {
|
|||||||
159 [label="Exit function test_6" style="filled" fillcolor=red];
|
159 [label="Exit function test_6" style="filled" fillcolor=red];
|
||||||
}
|
}
|
||||||
158 -> {160};
|
158 -> {160};
|
||||||
160 -> {161} [color=green];
|
160 -> {161};
|
||||||
160 -> {165} [color=red];
|
160 -> {165} [color=red];
|
||||||
161 -> {162};
|
161 -> {162};
|
||||||
162 -> {163};
|
162 -> {163};
|
||||||
|
|||||||
+1
-1
@@ -39,7 +39,7 @@ digraph lambdaAsReturnOfLambda_kt {
|
|||||||
11 [label="Exit property" style="filled" fillcolor=red];
|
11 [label="Exit property" style="filled" fillcolor=red];
|
||||||
}
|
}
|
||||||
10 -> {12};
|
10 -> {12};
|
||||||
12 -> {13} [color=green];
|
12 -> {13};
|
||||||
12 -> {0} [color=red];
|
12 -> {0} [color=red];
|
||||||
13 -> {14};
|
13 -> {14};
|
||||||
14 -> {15};
|
14 -> {15};
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ digraph lambdaReturningObject_kt {
|
|||||||
18 [label="Exit function foo" style="filled" fillcolor=red];
|
18 [label="Exit function foo" style="filled" fillcolor=red];
|
||||||
}
|
}
|
||||||
17 -> {19};
|
17 -> {19};
|
||||||
19 -> {20} [color=green];
|
19 -> {20};
|
||||||
19 -> {23} [color=red];
|
19 -> {23} [color=red];
|
||||||
20 -> {21};
|
20 -> {21};
|
||||||
21 -> {22};
|
21 -> {22};
|
||||||
|
|||||||
+1
-1
@@ -54,7 +54,7 @@ digraph postponedLambdaInConstructor_kt {
|
|||||||
13 -> {15};
|
13 -> {15};
|
||||||
14 -> {9} [color=green];
|
14 -> {9} [color=green];
|
||||||
14 -> {12} [color=red];
|
14 -> {12} [color=red];
|
||||||
15 -> {16} [color=green];
|
15 -> {16};
|
||||||
15 -> {17} [color=red];
|
15 -> {17} [color=red];
|
||||||
16 -> {14};
|
16 -> {14};
|
||||||
17 -> {19};
|
17 -> {19};
|
||||||
|
|||||||
+1
-1
@@ -477,7 +477,7 @@ digraph returns_kt {
|
|||||||
166 -> {167};
|
166 -> {167};
|
||||||
167 -> {145};
|
167 -> {145};
|
||||||
168 -> {169};
|
168 -> {169};
|
||||||
169 -> {170} [color=green];
|
169 -> {170};
|
||||||
169 -> {172} [color=red];
|
169 -> {172} [color=red];
|
||||||
170 -> {171};
|
170 -> {171};
|
||||||
171 -> {140};
|
171 -> {140};
|
||||||
|
|||||||
+1
-1
@@ -142,7 +142,7 @@ digraph safeCalls_kt {
|
|||||||
47 -> {44};
|
47 -> {44};
|
||||||
48 -> {50};
|
48 -> {50};
|
||||||
49 -> {53};
|
49 -> {53};
|
||||||
50 -> {51} [color=green];
|
50 -> {51};
|
||||||
50 -> {55} [color=red];
|
50 -> {55} [color=red];
|
||||||
51 -> {52};
|
51 -> {52};
|
||||||
52 -> {49};
|
52 -> {49};
|
||||||
|
|||||||
Vendored
+1
-1
@@ -274,7 +274,7 @@ digraph callsInPlace_kt {
|
|||||||
93 [label="Exit function test_8" style="filled" fillcolor=red];
|
93 [label="Exit function test_8" style="filled" fillcolor=red];
|
||||||
}
|
}
|
||||||
92 -> {94};
|
92 -> {94};
|
||||||
94 -> {95} [color=green];
|
94 -> {95};
|
||||||
94 -> {97} [color=red];
|
94 -> {97} [color=red];
|
||||||
95 -> {96};
|
95 -> {96};
|
||||||
96 -> {93};
|
96 -> {93};
|
||||||
|
|||||||
Vendored
+2
-2
@@ -163,14 +163,14 @@ digraph delegateWithAnonymousObject_kt {
|
|||||||
66 -> {54} [color=green];
|
66 -> {54} [color=green];
|
||||||
54 -> {56};
|
54 -> {56};
|
||||||
55 -> {67} [color=green];
|
55 -> {67} [color=green];
|
||||||
56 -> {57} [color=green];
|
56 -> {57};
|
||||||
57 -> {58};
|
57 -> {58};
|
||||||
58 -> {59};
|
58 -> {59};
|
||||||
59 -> {60};
|
59 -> {60};
|
||||||
60 -> {61};
|
60 -> {61};
|
||||||
61 -> {62};
|
61 -> {62};
|
||||||
62 -> {63};
|
62 -> {63};
|
||||||
63 -> {64} [color=green];
|
63 -> {64};
|
||||||
63 -> {21} [color=red];
|
63 -> {21} [color=red];
|
||||||
64 -> {65};
|
64 -> {65};
|
||||||
65 -> {55};
|
65 -> {55};
|
||||||
|
|||||||
+1
-1
@@ -155,7 +155,7 @@ finally {
|
|||||||
33 -> {41};
|
33 -> {41};
|
||||||
34 -> {35};
|
34 -> {35};
|
||||||
35 -> {36};
|
35 -> {36};
|
||||||
36 -> {37} [color=green];
|
36 -> {37};
|
||||||
36 -> {46} [color=red];
|
36 -> {46} [color=red];
|
||||||
37 -> {38};
|
37 -> {38};
|
||||||
38 -> {39};
|
38 -> {39};
|
||||||
|
|||||||
+15
-2
@@ -71,10 +71,23 @@ sealed class CFGNode<out E : FirElement>(val owner: ControlFlowGraph, val level:
|
|||||||
addJustKindEdge(from, to, kind, propagateDeadness)
|
addJustKindEdge(from, to, kind, propagateDeadness)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun merge(first: EdgeKind, second: EdgeKind?): EdgeKind? {
|
||||||
|
return when (first) {
|
||||||
|
second -> first
|
||||||
|
EdgeKind.Cfg -> if (second == EdgeKind.Dfg) null else first
|
||||||
|
EdgeKind.Dfg -> if (second == EdgeKind.Cfg) null else first
|
||||||
|
else -> first
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
internal fun addJustKindEdge(from: CFGNode<*>, to: CFGNode<*>, kind: EdgeKind, propagateDeadness: Boolean) {
|
internal fun addJustKindEdge(from: CFGNode<*>, to: CFGNode<*>, kind: EdgeKind, propagateDeadness: Boolean) {
|
||||||
if (kind != EdgeKind.Simple) {
|
if (kind != EdgeKind.Simple) {
|
||||||
from._outgoingEdges[to] = kind
|
merge(kind, from._outgoingEdges[to])?.let {
|
||||||
to._incomingEdges[from] = kind
|
from._outgoingEdges[to] = it
|
||||||
|
} ?: from._outgoingEdges.remove(to)
|
||||||
|
merge(kind, to._incomingEdges[from])?.let {
|
||||||
|
to._incomingEdges[from] = it
|
||||||
|
} ?: to._incomingEdges.remove(from)
|
||||||
}
|
}
|
||||||
if (propagateDeadness && kind == EdgeKind.Dead) {
|
if (propagateDeadness && kind == EdgeKind.Dead) {
|
||||||
to.isDead = true
|
to.isDead = true
|
||||||
|
|||||||
Reference in New Issue
Block a user