Commit 86fc8b6
committed
inlining: make union splitting account for uncovered call (#48455)
#44421 changed the union-splitting to skip generating
unnecessary fallback dynamic dispatch call when there is any fully
covered call.
But it turned out that this is only valid when there is any fully
covered call in matches for all signatures that inference split, and it
is invalid if there is any union split signature against which any
uncovered call is found.
Consider the following example:
# case 1
# def
nosplit(::Any) = [...]
nosplit(::Int) = [...]
# call
nosplit(a::Any)
split1: a::Any ┬ nosplit(a::Int)
└ nosplit(a::Any) # fully covers split1
# case 2
# def
convert(::Type{T}, ::T) = T
# call
convert(::Type{Union{Bool,Tuple{Int,String}}}, a::Union{Bool,Tuple{Int,Any}})
split1: a::Bool ─ convert(::Type{Bool}, ::Bool) # fully covers split1
split2: a::Tuple{Int,Any} ─ convert(::Type{Tuple{Int,String}}, ::Tuple{Int,String}) # NOT fully covers split2
#44421 allows us to optimize the the first case, but
handles the second case wrongly. This commit fixes it up while still
optimizing the first case.
fix #48397.1 parent 9a67956 commit 86fc8b6
2 files changed
+26
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1348 | 1348 | | |
1349 | 1349 | | |
1350 | 1350 | | |
1351 | | - | |
1352 | 1351 | | |
1353 | 1352 | | |
1354 | 1353 | | |
1355 | 1354 | | |
1356 | 1355 | | |
1357 | 1356 | | |
1358 | | - | |
| 1357 | + | |
1359 | 1358 | | |
1360 | 1359 | | |
1361 | 1360 | | |
| |||
1377 | 1376 | | |
1378 | 1377 | | |
1379 | 1378 | | |
| 1379 | + | |
1380 | 1380 | | |
1381 | 1381 | | |
1382 | 1382 | | |
1383 | 1383 | | |
1384 | | - | |
1385 | | - | |
| 1384 | + | |
1386 | 1385 | | |
1387 | 1386 | | |
1388 | 1387 | | |
| |||
1399 | 1398 | | |
1400 | 1399 | | |
1401 | 1400 | | |
| 1401 | + | |
1402 | 1402 | | |
1403 | 1403 | | |
1404 | | - | |
| 1404 | + | |
1405 | 1405 | | |
1406 | 1406 | | |
1407 | 1407 | | |
| |||
1428 | 1428 | | |
1429 | 1429 | | |
1430 | 1430 | | |
1431 | | - | |
| 1431 | + | |
1432 | 1432 | | |
1433 | 1433 | | |
1434 | 1434 | | |
1435 | 1435 | | |
1436 | 1436 | | |
1437 | | - | |
| 1437 | + | |
1438 | 1438 | | |
1439 | 1439 | | |
1440 | 1440 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1801 | 1801 | | |
1802 | 1802 | | |
1803 | 1803 | | |
| 1804 | + | |
| 1805 | + | |
| 1806 | + | |
| 1807 | + | |
| 1808 | + | |
| 1809 | + | |
| 1810 | + | |
| 1811 | + | |
| 1812 | + | |
| 1813 | + | |
| 1814 | + | |
| 1815 | + | |
| 1816 | + | |
| 1817 | + | |
| 1818 | + | |
| 1819 | + | |
| 1820 | + | |
| 1821 | + | |
| 1822 | + | |
0 commit comments