Optimize more redundant kotlin/jvm/internal/Refs
The number of initializations of the `value` field before the live range begins does not really matter so long as we insert a write of a default value to the local if there were none.
This commit is contained in:
Vendored
-3
@@ -1,6 +1,3 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// TODO KT-36648 Captured variables not optimized in JVM_IR
|
||||
|
||||
fun test() {
|
||||
var x = 0
|
||||
run {
|
||||
|
||||
-3
@@ -1,6 +1,3 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// TODO KT-36648 Captured variables not optimized in JVM_IR
|
||||
|
||||
fun test() {
|
||||
var x = 0
|
||||
run { ++x }
|
||||
|
||||
-7
@@ -1,11 +1,4 @@
|
||||
// WITH_RUNTIME
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// TODO KT-36648 Captured variables not optimized in JVM_IR
|
||||
|
||||
// In JVM IR, SharedVariablesLowering transforms `x` into a shared variable to be able to update it from a lambda,
|
||||
// which is a separate function (...$lambda-0).
|
||||
// If we keep the existing representation of lambda bodies as separate functions in JVM IR, the only viable option to fix this test
|
||||
// seems to support this case in the bytecode optimization pass CapturedVarsOptimizationMethodTransformer.
|
||||
|
||||
fun box(): String {
|
||||
val x: String
|
||||
|
||||
-3
@@ -1,6 +1,3 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// TODO KT-36648 Captured variables not optimized in JVM_IR
|
||||
|
||||
fun box(): String {
|
||||
var xl = 0L // Long, size 2
|
||||
var xi = 0 // Int, size 1
|
||||
|
||||
-3
@@ -1,6 +1,3 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// TODO KT-36648 Captured variables not optimized in JVM_IR
|
||||
|
||||
fun add(x: Int, y: Int) = x + y
|
||||
|
||||
fun test() {
|
||||
|
||||
Reference in New Issue
Block a user