Don't generate jump for last when condition

This commit is contained in:
Mikhael Bogdanov
2019-11-15 12:03:45 +01:00
parent 9a07063d8b
commit e409387078
5 changed files with 83 additions and 1 deletions
@@ -0,0 +1,17 @@
// KOTLIN_CONFIGURATION_FLAGS: +JVM.DISABLE_OPTIMIZATION
fun consume(i: Int) {}
fun foo(a: String) {
var b = 1
if (a[1] == 'b') {
b = 2
} else if (a[0] == 'a') {
b = 3
}
consume(b)
}
// 1 GOTO
// 2 IF
@@ -0,0 +1,15 @@
// KOTLIN_CONFIGURATION_FLAGS: +JVM.DISABLE_OPTIMIZATION
fun consume(i: Int) {}
fun foo(a: Boolean) {
var b = 1
if (a) {
b = 2
}
consume(b)
}
// 0 GOTO
// 1 IF