Commit e3b681c
authored
inference: always use const-prop'ed result (#44001)
Previously, for `invoke`/opaque closure callsite, we use constant-prop'ed
method body only when the inferred return type gets strictly improved
by const-prop. But since the inliner is now able to inline the method
body from `InferenceResult`, I believe it is always better to use method
body shaped up by const-prop' no matter if the return type is improved
(as we already do for ordinal call sites).
> use constant prop' result even when the return type doesn't get refined
```julia
const Gx = Ref{Any}()
Base.@constprop :aggressive function conditional_escape!(cnd, x)
if cnd
Gx[] = x
end
return nothing
end
@test fully_eliminated((String,)) do x
Base.@invoke conditional_escape!(false::Any, x::Any)
end
```1 parent b405562 commit e3b681c
File tree
2 files changed
+20
-20
lines changed- base/compiler
- test/compiler
2 files changed
+20
-20
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
| 88 | + | |
92 | 89 | | |
93 | 90 | | |
94 | 91 | | |
| |||
125 | 122 | | |
126 | 123 | | |
127 | 124 | | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
| 125 | + | |
132 | 126 | | |
133 | 127 | | |
134 | 128 | | |
| |||
622 | 616 | | |
623 | 617 | | |
624 | 618 | | |
625 | | - | |
| 619 | + | |
626 | 620 | | |
627 | 621 | | |
628 | 622 | | |
| |||
1364 | 1358 | | |
1365 | 1359 | | |
1366 | 1360 | | |
1367 | | - | |
1368 | | - | |
1369 | | - | |
1370 | | - | |
| 1361 | + | |
1371 | 1362 | | |
1372 | | - | |
| 1363 | + | |
1373 | 1364 | | |
1374 | 1365 | | |
1375 | 1366 | | |
| |||
1491 | 1482 | | |
1492 | 1483 | | |
1493 | 1484 | | |
1494 | | - | |
| 1485 | + | |
1495 | 1486 | | |
1496 | 1487 | | |
1497 | 1488 | | |
1498 | 1489 | | |
1499 | | - | |
1500 | | - | |
1501 | | - | |
1502 | | - | |
| 1490 | + | |
1503 | 1491 | | |
1504 | 1492 | | |
1505 | | - | |
| 1493 | + | |
1506 | 1494 | | |
1507 | 1495 | | |
1508 | 1496 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
895 | 895 | | |
896 | 896 | | |
897 | 897 | | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
| 901 | + | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
0 commit comments