mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-08 15:53:19 +00:00
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
27 lines
441 B
Kotlin
Vendored
27 lines
441 B
Kotlin
Vendored
fun test() {
|
|
val a = inlineFunInt { 1 }
|
|
val b = simpleFunInt { 1 }
|
|
val c = inlineFunVoid { val aa = 1 }
|
|
val d = simpleFunVoid { val aa = 1 }
|
|
}
|
|
|
|
inline fun inlineFunInt(f: () -> Int): Int {
|
|
val a = 1
|
|
return f()
|
|
}
|
|
|
|
inline fun inlineFunVoid(f: () -> Unit): Unit {
|
|
val a = 1
|
|
return f()
|
|
}
|
|
|
|
fun simpleFunInt(f: () -> Int): Int {
|
|
return f()
|
|
}
|
|
|
|
fun simpleFunVoid(f: () -> Unit): Unit {
|
|
return f()
|
|
}
|
|
|
|
// 3 NOP
|