[K/N][IR][optmz] Global analysis for top-level initializers

The analysis' goal is to remove redundant calls to initializers
This commit is contained in:
Igor Chevdar
2021-03-24 20:39:52 +05:00
parent 9c6943b8c4
commit 448376f073
19 changed files with 952 additions and 75 deletions
@@ -0,0 +1,26 @@
/*
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
// FILE: lib.kt
val y = getY()
private fun getY() = 42
fun bar(x: Int) = x == 0
// FILE: main.kt
fun foo(x: Int) {
var i = 0
do {
++i
if (i > 0) continue
bar(i)
} while (i < x)
}
fun main() {
foo(0)
println(y)
}