JVM_IR allow remapped variables in inplace arguments transformation

This commit is contained in:
Dmitry Petrov
2021-09-05 17:30:36 +03:00
committed by TeamCityServer
parent 09c8ca860a
commit e28d4a1877
8 changed files with 59 additions and 14 deletions
@@ -32,8 +32,8 @@ fun box(): String {
// 0 INEG
// 0 INVOKESTATIC kotlin/UInt.constructor-impl
// 0 INVOKE\w+ kotlin/UInt.(un)?box-impl
// 21 ILOAD
// 13 ISTORE
// 15 ILOAD
// 7 ISTORE
// 1 IADD
// 0 ISUB
// 0 IINC
@@ -42,8 +42,8 @@ fun box(): String {
// 1 INEG
// 0 INVOKESTATIC kotlin/UInt.constructor-impl
// 0 INVOKE\w+ kotlin/UInt.(un)?box-impl
// 25 ILOAD
// 15 ISTORE
// 19 ILOAD
// 9 ISTORE
// 1 IADD
// 0 ISUB
// 0 IINC
@@ -40,8 +40,8 @@ fun box(): String {
// 0 INEG
// 0 INVOKESTATIC kotlin/UInt.constructor-impl
// 0 INVOKE\w+ kotlin/UInt.(un)?box-impl
// 12 ILOAD
// 9 ISTORE
// 8 ILOAD
// 5 ISTORE
// 0 IADD
// 0 ISUB
// 1 IINC
@@ -0,0 +1,15 @@
// WITH_RUNTIME
fun vectorReductionMax(vA: DoubleArray): Double {
val n = vA.size
var x = Double.NEGATIVE_INFINITY
for (i in 0 until n) {
x = kotlin.math.max(x, vA[i])
}
return x
}
// JVM_IR_TEMPLATES
// Make sure there's no intermediate variable created for 'vA[i]' argument of kotlin.math.max.
// 2 DLOAD
// 2 DSTORE