JVM_IR KT-42010 use IINC for postfix int increment/decrement

This commit is contained in:
Dmitry Petrov
2021-08-26 16:09:39 +03:00
parent ef72413da9
commit dd98f72fd7
8 changed files with 131 additions and 2 deletions
@@ -0,0 +1,34 @@
// IGNORE_BACKEND_FIR: JVM_IR
fun use(i: Int) {}
fun testPostfixIncr0() {
var k = 0
k++
use(k)
}
fun testPostfixIncr1() {
var k = 0
val t = k++
use(k)
use(t)
}
fun testPostfixDecr0() {
var k = 0
k--
use(k)
}
fun testPostfixDecr1() {
var k = 0
val t = k--
use(k)
use(t)
}
// 6 ISTORE
// 8 ILOAD
// 0 ICONST_1
// 4 IINC