Commit d9ed370
authored
Fix ILLink/ILC hang when tracking too many hoisted local values (#95041)
#87634 introduced a limit
on the number of values tracked in dataflow analysis, but this
approach was incorrect because resetting the set of tracked
values was effectively moving up the dataflow lattice, breaking
the invariant and causing potential hangs.
The hang was observed in
#94831, where (as found
by @vitek-karas) the hoisted local `state` field of an async
method with many await points was getting a large number of
tracked values, hitting the limit, being reset to "empty", but
then growing again, causing the analysis not to converge.
The fix is to instead introduce a special value
`ValueSet<TValue>.Unknown` that is used for this case. It acts
like "bottom" in the lattice, so that it destroys any other
inputs on meet ("bottom" meet anything else is "bottom").
In this testcase the `state` field isn't involved in dataflow
warnings, so this actually allows the method to be analyzed
correctly, producing the expected warning for the `Type` local
that flows across all of the await points.
Fixes #948311 parent a26802a commit d9ed370
File tree
24 files changed
+264
-139
lines changed- src
- coreclr/tools/aot/ILCompiler.Compiler/Compiler/Dataflow
- tools/illink
- src
- ILLink.RoslynAnalyzer
- DataFlow
- TrimAnalysis
- linker/Linker.Dataflow
- test/Mono.Linker.Tests.Cases/DataFlow
24 files changed
+264
-139
lines changedLines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| |||
92 | 92 | | |
93 | 93 | | |
94 | 94 | | |
95 | | - | |
| 95 | + | |
96 | 96 | | |
97 | 97 | | |
98 | 98 | | |
| |||
123 | 123 | | |
124 | 124 | | |
125 | 125 | | |
126 | | - | |
| 126 | + | |
127 | 127 | | |
128 | 128 | | |
129 | 129 | | |
| |||
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
70 | | - | |
| 70 | + | |
| 71 | + | |
71 | 72 | | |
72 | 73 | | |
73 | 74 | | |
| |||
Lines changed: 10 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
210 | 210 | | |
211 | 211 | | |
212 | 212 | | |
213 | | - | |
| 213 | + | |
214 | 214 | | |
215 | 215 | | |
216 | 216 | | |
| |||
309 | 309 | | |
310 | 310 | | |
311 | 311 | | |
312 | | - | |
| 312 | + | |
| 313 | + | |
313 | 314 | | |
314 | 315 | | |
315 | 316 | | |
| |||
327 | 328 | | |
328 | 329 | | |
329 | 330 | | |
330 | | - | |
| 331 | + | |
| 332 | + | |
331 | 333 | | |
332 | 334 | | |
333 | 335 | | |
| |||
1018 | 1020 | | |
1019 | 1021 | | |
1020 | 1022 | | |
1021 | | - | |
| 1023 | + | |
1022 | 1024 | | |
1023 | 1025 | | |
1024 | 1026 | | |
| |||
1137 | 1139 | | |
1138 | 1140 | | |
1139 | 1141 | | |
1140 | | - | |
| 1142 | + | |
1141 | 1143 | | |
1142 | 1144 | | |
1143 | 1145 | | |
| |||
1189 | 1191 | | |
1190 | 1192 | | |
1191 | 1193 | | |
1192 | | - | |
| 1194 | + | |
1193 | 1195 | | |
1194 | 1196 | | |
1195 | 1197 | | |
| |||
1324 | 1326 | | |
1325 | 1327 | | |
1326 | 1328 | | |
1327 | | - | |
| 1329 | + | |
1328 | 1330 | | |
1329 | 1331 | | |
1330 | 1332 | | |
| |||
1366 | 1368 | | |
1367 | 1369 | | |
1368 | 1370 | | |
1369 | | - | |
| 1371 | + | |
1370 | 1372 | | |
1371 | 1373 | | |
1372 | 1374 | | |
| |||
Lines changed: 5 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
431 | 431 | | |
432 | 432 | | |
433 | 433 | | |
434 | | - | |
| 434 | + | |
435 | 435 | | |
436 | 436 | | |
437 | 437 | | |
| |||
466 | 466 | | |
467 | 467 | | |
468 | 468 | | |
469 | | - | |
| 469 | + | |
470 | 470 | | |
471 | 471 | | |
472 | 472 | | |
| |||
497 | 497 | | |
498 | 498 | | |
499 | 499 | | |
500 | | - | |
| 500 | + | |
501 | 501 | | |
502 | 502 | | |
503 | 503 | | |
| |||
521 | 521 | | |
522 | 522 | | |
523 | 523 | | |
524 | | - | |
| 524 | + | |
525 | 525 | | |
526 | 526 | | |
527 | 527 | | |
| |||
619 | 619 | | |
620 | 620 | | |
621 | 621 | | |
622 | | - | |
| 622 | + | |
623 | 623 | | |
624 | 624 | | |
625 | 625 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
51 | | - | |
| 51 | + | |
52 | 52 | | |
53 | | - | |
| 53 | + | |
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
| |||
Lines changed: 9 additions & 17 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
18 | | - | |
| 17 | + | |
| 18 | + | |
19 | 19 | | |
20 | | - | |
| 20 | + | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
| 24 | + | |
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
| 31 | + | |
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | | - | |
| 36 | + | |
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
43 | | - | |
| 43 | + | |
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
| 48 | + | |
53 | 49 | | |
54 | 50 | | |
55 | 51 | | |
56 | 52 | | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
| 53 | + | |
62 | 54 | | |
63 | 55 | | |
64 | 56 | | |
| |||
Lines changed: 3 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
50 | 51 | | |
51 | 52 | | |
52 | 53 | | |
53 | | - | |
| 54 | + | |
| 55 | + | |
54 | 56 | | |
55 | 57 | | |
56 | 58 | | |
| |||
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
82 | | - | |
| 82 | + | |
| 83 | + | |
83 | 84 | | |
84 | 85 | | |
85 | 86 | | |
| |||
Lines changed: 6 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
390 | 390 | | |
391 | 391 | | |
392 | 392 | | |
| 393 | + | |
393 | 394 | | |
394 | 395 | | |
395 | | - | |
| 396 | + | |
396 | 397 | | |
397 | 398 | | |
398 | 399 | | |
| |||
409 | 410 | | |
410 | 411 | | |
411 | 412 | | |
412 | | - | |
| 413 | + | |
413 | 414 | | |
414 | 415 | | |
415 | 416 | | |
| |||
517 | 518 | | |
518 | 519 | | |
519 | 520 | | |
520 | | - | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
521 | 524 | | |
522 | 525 | | |
523 | 526 | | |
| |||
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| 44 | + | |
44 | 45 | | |
45 | 46 | | |
46 | 47 | | |
| |||
0 commit comments