JVM_IR KT-34594 strip fake variable initialization during inlining
This commit is contained in:
@@ -49,4 +49,5 @@ class A {
|
||||
|
||||
fun calcRequiredLayoutSize(count: Int, max: Int, toInt: Int) = 0
|
||||
|
||||
// 3 ISTORE 10
|
||||
|
||||
// 2 ISTORE 10
|
||||
+13
-7
@@ -1,17 +1,23 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
|
||||
@Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER")
|
||||
@kotlin.internal.InlineOnly
|
||||
inline fun inlineOnlyFun() = 42
|
||||
inline fun inlineOnlyFun(): Int {
|
||||
var unused = 0
|
||||
var used1 = 0
|
||||
var used2 = 0
|
||||
++used2
|
||||
return 42 + used1
|
||||
}
|
||||
|
||||
fun test() = inlineOnlyFun()
|
||||
|
||||
// JVM_TEMPLATES
|
||||
// 1 LDC 0
|
||||
// 1 ICONST_0
|
||||
// 0 ISTORE 1
|
||||
// 2 ISTORE 0
|
||||
// 5 ICONST_0
|
||||
// 6 ISTORE
|
||||
|
||||
// JVM_IR_TEMPLATES
|
||||
// 0 LDC 0
|
||||
// 0 ICONST_0
|
||||
// 0 ISTORE 1
|
||||
// 0 ISTORE 0
|
||||
// 5 ICONST_0
|
||||
// 5 ISTORE
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
import kotlin.math.sin
|
||||
|
||||
fun test(x: Double) = sin(x)
|
||||
|
||||
// 0 LDC 0
|
||||
// 0 ICONST_0
|
||||
// 0 ISTORE
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun test(xs: List<String>) =
|
||||
xs.map { it.length }
|
||||
|
||||
// $i$f$map, $i$f$mapTo, $i$a$-map-NoFakeVariableForInlineOnlyFunMapKt$test$1
|
||||
// 3 ICONST_0
|
||||
// 3 ISTORE
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun test() = run {
|
||||
var tmp = 0
|
||||
"OK"
|
||||
}
|
||||
|
||||
// 2 LOCALVARIABLE
|
||||
// 1 LOCALVARIABLE tmp I
|
||||
// 1 LOCALVARIABLE \$i\$a\$-run-NoFakeVariableForInlineOnlyFunWithLambdaKt\$test\$1 I
|
||||
|
||||
// 0 LDC 0
|
||||
// 2 ICONST_0
|
||||
// 2 ISTORE
|
||||
Reference in New Issue
Block a user