FIR CFG: merge data flow if called-in-place lambda may not be called

This commit is contained in:
pyos
2022-06-30 11:26:32 +02:00
committed by Dmitriy Novozhilov
parent 06c7572ee5
commit 5a2ec4a0d5
23 changed files with 594 additions and 129 deletions
@@ -80,8 +80,7 @@ digraph callsInPlace_kt {
17 -> {18};
18 -> {19};
19 -> {20};
20 -> {25};
20 -> {21} [color=red];
20 -> {21 25};
20 -> {25} [style=dashed];
21 -> {22};
22 -> {23};
@@ -90,7 +89,7 @@ digraph callsInPlace_kt {
26 -> {27};
27 -> {28};
28 -> {29};
29 -> {21} [color=green];
29 -> {21};
29 -> {25} [color=green style=dashed];
subgraph cluster_8 {
@@ -120,8 +119,7 @@ digraph callsInPlace_kt {
}
30 -> {31};
31 -> {32};
32 -> {38};
32 -> {33} [color=red];
32 -> {33 38};
32 -> {38} [style=dashed];
33 -> {34};
34 -> {35};
@@ -131,7 +129,7 @@ digraph callsInPlace_kt {
39 -> {40};
40 -> {41};
41 -> {42};
42 -> {33} [color=green];
42 -> {33};
42 -> {38} [color=green style=dashed];
subgraph cluster_12 {
@@ -293,12 +291,10 @@ digraph callsInPlace_kt {
}
85 -> {86};
86 -> {87};
87 -> {99};
87 -> {88} [color=red];
87 -> {88 99};
87 -> {99} [style=dashed];
88 -> {89};
89 -> {94};
89 -> {90} [color=red];
89 -> {90 94};
89 -> {94} [style=dashed];
90 -> {91};
91 -> {92};
@@ -307,13 +303,13 @@ digraph callsInPlace_kt {
95 -> {96};
96 -> {97};
97 -> {98};
98 -> {90} [color=green];
98 -> {90};
98 -> {94} [color=green style=dashed];
99 -> {103 100};
100 -> {101};
101 -> {102};
102 -> {103};
103 -> {88} [color=green];
103 -> {88};
103 -> {99} [color=green style=dashed];
subgraph cluster_28 {
@@ -355,12 +351,10 @@ digraph callsInPlace_kt {
}
104 -> {105};
105 -> {106};
106 -> {113};
106 -> {107} [color=red];
106 -> {107 113};
106 -> {113} [style=dashed];
107 -> {108};
108 -> {118};
108 -> {109} [color=red];
108 -> {109 118};
108 -> {118} [style=dashed];
109 -> {110};
110 -> {111};
@@ -369,13 +363,13 @@ digraph callsInPlace_kt {
114 -> {115};
115 -> {116};
116 -> {117};
117 -> {107} [color=green];
117 -> {107};
117 -> {113} [color=green style=dashed];
118 -> {122 119};
119 -> {120};
120 -> {121};
121 -> {122};
122 -> {109} [color=green];
122 -> {109};
122 -> {118} [color=green style=dashed];
subgraph cluster_34 {
@@ -45,88 +45,94 @@ digraph atLeastOnce_kt {
13 [label="Postponed enter to lambda"];
subgraph cluster_6 {
color=blue
20 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
21 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
subgraph cluster_7 {
color=blue
21 [label="Enter block"];
22 [label="Const: Int(1)"];
23 [label="Assignment: R|<local>/x|"];
24 [label="Exit block"];
22 [label="Enter block"];
23 [label="Const: Int(1)"];
24 [label="Assignment: R|<local>/x|"];
25 [label="Exit block"];
}
25 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
26 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
}
14 [label="Postponed exit from lambda"];
15 [label="Function call: R|/inlineRun|(...)"];
16 [label="Access variable R|<local>/x|"];
17 [label="Function call: R|<local>/x|.R|kotlin/Int.inc|()"];
18 [label="Exit block"];
14 [label="Call arguments union" style="filled" fillcolor=yellow];
15 [label="Postponed exit from lambda"];
16 [label="Function call: R|/inlineRun|(...)"];
17 [label="Access variable R|<local>/x|"];
18 [label="Function call: R|<local>/x|.R|kotlin/Int.inc|()"];
19 [label="Exit block"];
}
19 [label="Exit function test_1" style="filled" fillcolor=red];
20 [label="Exit function test_1" style="filled" fillcolor=red];
}
10 -> {11};
11 -> {12};
12 -> {13};
13 -> {20};
13 -> {14} [color=red];
13 -> {20} [style=dashed];
14 -> {15};
15 -> {16};
13 -> {21};
13 -> {15} [color=red];
13 -> {21} [style=dashed];
14 -> {16} [color=red];
15 -> {16} [color=green];
16 -> {17};
17 -> {18};
18 -> {19};
20 -> {21};
19 -> {20};
21 -> {22};
22 -> {23};
23 -> {24};
24 -> {25};
25 -> {14} [color=green];
25 -> {20} [color=green style=dashed];
25 -> {26};
26 -> {14} [color=red];
26 -> {15} [color=green];
26 -> {21} [color=green style=dashed];
subgraph cluster_8 {
color=red
26 [label="Enter function test_2" style="filled" fillcolor=red];
27 [label="Enter function test_2" style="filled" fillcolor=red];
subgraph cluster_9 {
color=blue
27 [label="Enter block"];
28 [label="Variable declaration: lval x: R|kotlin/Int|"];
29 [label="Postponed enter to lambda"];
28 [label="Enter block"];
29 [label="Variable declaration: lval x: R|kotlin/Int|"];
30 [label="Postponed enter to lambda"];
subgraph cluster_10 {
color=blue
36 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
38 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
subgraph cluster_11 {
color=blue
37 [label="Enter block"];
38 [label="Const: Int(1)"];
39 [label="Assignment: R|<local>/x|"];
40 [label="Exit block"];
39 [label="Enter block"];
40 [label="Const: Int(1)"];
41 [label="Assignment: R|<local>/x|"];
42 [label="Exit block"];
}
41 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
43 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
}
30 [label="Postponed exit from lambda"];
31 [label="Function call: R|/myRun|(...)"];
32 [label="Access variable R|<local>/x|"];
33 [label="Function call: R|<local>/x|.R|kotlin/Int.inc|()"];
34 [label="Exit block"];
31 [label="Call arguments union" style="filled" fillcolor=yellow];
32 [label="Postponed exit from lambda"];
33 [label="Function call: R|/myRun|(...)"];
34 [label="Access variable R|<local>/x|"];
35 [label="Function call: R|<local>/x|.R|kotlin/Int.inc|()"];
36 [label="Exit block"];
}
35 [label="Exit function test_2" style="filled" fillcolor=red];
37 [label="Exit function test_2" style="filled" fillcolor=red];
}
26 -> {27};
27 -> {28};
28 -> {29};
29 -> {36};
29 -> {30} [color=red];
29 -> {36} [style=dashed];
30 -> {31};
31 -> {32};
32 -> {33};
29 -> {30};
30 -> {38};
30 -> {32} [color=red];
30 -> {38} [style=dashed];
31 -> {33} [color=red];
32 -> {33} [color=green];
33 -> {34};
34 -> {35};
35 -> {36};
36 -> {37};
37 -> {38};
38 -> {39};
39 -> {40};
40 -> {41};
41 -> {30} [color=green];
41 -> {36} [color=green style=dashed];
41 -> {42};
42 -> {43};
43 -> {31} [color=red];
43 -> {32} [color=green];
43 -> {38} [color=green style=dashed];
}
@@ -66,8 +66,7 @@ digraph atMostOnce_kt {
10 -> {11};
11 -> {12};
12 -> {13};
13 -> {20};
13 -> {14} [color=red];
13 -> {14 20};
13 -> {20} [style=dashed];
14 -> {15};
15 -> {16};
@@ -79,7 +78,7 @@ digraph atMostOnce_kt {
22 -> {23};
23 -> {24};
24 -> {25};
25 -> {14} [color=green];
25 -> {14};
subgraph cluster_8 {
color=red
@@ -112,8 +111,7 @@ digraph atMostOnce_kt {
26 -> {27};
27 -> {28};
28 -> {29};
29 -> {36};
29 -> {30} [color=red];
29 -> {30 36};
29 -> {36} [style=dashed];
30 -> {31};
31 -> {32};
@@ -125,6 +123,6 @@ digraph atMostOnce_kt {
38 -> {39};
39 -> {40};
40 -> {41};
41 -> {30} [color=green];
41 -> {30};
}
@@ -76,8 +76,7 @@ digraph inPlaceLambda_kt {
15 -> {16};
16 -> {17};
17 -> {18};
18 -> {23};
18 -> {19} [color=red];
18 -> {19 23};
18 -> {23} [style=dashed];
19 -> {20};
20 -> {21};
@@ -86,6 +85,6 @@ digraph inPlaceLambda_kt {
24 -> {25};
25 -> {26};
26 -> {27};
27 -> {19} [color=green];
27 -> {19};
}
@@ -66,8 +66,7 @@ digraph unknown_kt {
10 -> {11};
11 -> {12};
12 -> {13};
13 -> {20};
13 -> {14} [color=red];
13 -> {14 20};
13 -> {20} [style=dashed];
14 -> {15};
15 -> {16};
@@ -79,7 +78,7 @@ digraph unknown_kt {
22 -> {23};
23 -> {24};
24 -> {25};
25 -> {14} [color=green];
25 -> {14};
25 -> {20} [color=green style=dashed];
subgraph cluster_8 {
@@ -113,8 +112,7 @@ digraph unknown_kt {
26 -> {27};
27 -> {28};
28 -> {29};
29 -> {36};
29 -> {30} [color=red];
29 -> {30 36};
29 -> {36} [style=dashed];
30 -> {31};
31 -> {32};
@@ -126,7 +124,7 @@ digraph unknown_kt {
38 -> {39};
39 -> {40};
40 -> {41};
41 -> {30} [color=green];
41 -> {30};
41 -> {36} [color=green style=dashed];
}
@@ -146,8 +146,7 @@ digraph plusAssignWithLambdaInRhs_kt {
37 -> {38};
38 -> {39};
39 -> {40};
40 -> {45};
40 -> {41} [color=red];
40 -> {41 45};
40 -> {45} [style=dashed];
41 -> {42};
42 -> {43};
@@ -157,7 +156,7 @@ digraph plusAssignWithLambdaInRhs_kt {
47 -> {48};
48 -> {49};
49 -> {50};
50 -> {41} [color=green];
50 -> {41};
50 -> {45} [color=green style=dashed];
}
@@ -105,8 +105,7 @@ finally {
14 -> {15};
15 -> {16};
16 -> {17};
17 -> {31};
17 -> {18} [color=red];
17 -> {18 31};
17 -> {31} [style=dashed];
18 -> {19};
19 -> {20};
@@ -126,7 +125,7 @@ finally {
32 -> {33};
33 -> {34};
34 -> {35};
35 -> {18} [color=green];
35 -> {18};
35 -> {31} [color=green style=dashed];
subgraph cluster_13 {