[JS IR] Materialize Unit more aggressively for IrCalls

Unit materialization for IrCall is required for operations with dynamic type.

However it produces useless Unit_getInstance() calls,
especially in return expressions. The pach also adds some heuristics
for reducing the amount of Unit_getInstance() calls from return expressions:
do not add Unit_getInstance() if return value has Unit type.

Relaited to KT-51139
^KT-23252 Fixed
This commit is contained in:
Alexander Korepanov
2022-04-13 21:03:33 +03:00
committed by Space
parent 677ec12b50
commit 57f16e801f
6 changed files with 258 additions and 26 deletions
+1 -1
View File
@@ -15,4 +15,4 @@ suspend fun bar(): Unit {
}
// LINES(JS): 39 4 4 4 7 5 5 45 45 5 93 45 5 5 6 4 4 4 9 15 9 9 9 * 9 15 10 10 11 11 11 11 11 * 11 12 12 13 13 13 13 13 13 13 14 14 * 9 15 9 9 9 9
// LINES(JS_IR): 19 19 * 50 50 93 93 3 45 45 3 45 6 6 19 * 9 9 9 9 9 9 9 9 * 9 9 * 10 10 * 11 * 11 12 12 * 13 * 13 13 14 14
// LINES(JS_IR): 19 19 * 50 50 93 93 3 45 3 45 45 6 6 19 * 9 9 9 9 9 9 9 9 * 9 9 * 10 10 * 11 * 11 12 12 * 13 * 13 13 14 14