Files
kotlin/compiler/testData/codegen/bytecodeText/coercionToUnitOptimization/safeCall.kt
Dmitry Petrov f1b061d662 Optimize coercion to Unit.
POP operations are backward-propagated.

Operation can't be transformed if its result is moved within stack
(by DUP, DUP_X1, DUP_X2, DUP2, DUP2_X1, DUP2_X2, or SWAP).

Unnecessary operations are replaced with NOPs (for debugger).
Unnecessary NOPs are removed.

KT-9922 Suboptimal generation for simple safe call with unused return value
KT-11116 Optimize methods returning Unit
2016-04-07 11:40:58 +03:00

11 lines
91 B
Kotlin
Vendored

interface A {
fun foo()
}
fun test(x: A?) {
x?.foo()
}
// 1 POP
// 0 ACONST_NULL