JVM_IR: defer some branch optimizations to codegen.
Specifically, defer the removal of hand-written "if (true|false)" from JvmBuiltinOptimizationLowering into codegen so that appropriate debug info (and a NOP) can be inserted. Change-Id: Ia11af05ad8b4251946bd3e685fb7c3319f0f433f
This commit is contained in:
committed by
max-kammerer
parent
6bbb0269b1
commit
013ad4b8e4
@@ -0,0 +1,35 @@
|
||||
fun cond() = false
|
||||
|
||||
fun bar() {}
|
||||
|
||||
fun foo() {
|
||||
if (cond()) {
|
||||
bar()
|
||||
} else if (true) {
|
||||
bar()
|
||||
} else {
|
||||
bar()
|
||||
}
|
||||
|
||||
if (false) {
|
||||
bar()
|
||||
} else if (true) {
|
||||
bar()
|
||||
} else {
|
||||
bar()
|
||||
}
|
||||
|
||||
if (true) {
|
||||
bar()
|
||||
} else if (false) {
|
||||
bar()
|
||||
} else {
|
||||
bar()
|
||||
}
|
||||
}
|
||||
|
||||
// 1 LINENUMBER 6
|
||||
// 1 LINENUMBER 8
|
||||
// 1 LINENUMBER 14
|
||||
// 1 LINENUMBER 16
|
||||
// 1 LINENUMBER 22
|
||||
@@ -0,0 +1,7 @@
|
||||
fun foo(): Int {
|
||||
if (false) {
|
||||
return 1
|
||||
}
|
||||
return 2
|
||||
}
|
||||
// 1 LINENUMBER 2
|
||||
@@ -0,0 +1,8 @@
|
||||
fun foo(): Int {
|
||||
if (false) {
|
||||
return 1
|
||||
} else {
|
||||
return 2
|
||||
}
|
||||
}
|
||||
// 1 LINENUMBER 2
|
||||
@@ -0,0 +1,7 @@
|
||||
fun foo(): Int {
|
||||
if (true) {
|
||||
return 1
|
||||
}
|
||||
return 2
|
||||
}
|
||||
// 1 LINENUMBER 2
|
||||
@@ -0,0 +1,8 @@
|
||||
fun foo(): Int {
|
||||
if (true) {
|
||||
return 1
|
||||
} else {
|
||||
return 2
|
||||
}
|
||||
}
|
||||
// 1 LINENUMBER 2
|
||||
Reference in New Issue
Block a user