KT53119: Implement String Concatenation Type Narrowing to improve escape analysis

Merge-request: KT-MR-6661
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
This commit is contained in:
Vladimir Sukharev
2022-07-20 16:28:33 +00:00
committed by Space
parent 73226aba00
commit d378d7d5f5
25 changed files with 647 additions and 9 deletions
@@ -7,7 +7,7 @@ class C {
fun foo(x: Int) = x
}
// CHECK: define void @"kfun:#main(){}"()
// CHECK-LABEL: define void @"kfun:#main(){}"()
// CHECK-NOT: Int-box
// TODO Remove next check after fix of https://youtrack.jetbrains.com/issue/KT-53100/Optimization-needed-T-unboxCONSTANTPRIMITIVEx-T-x
// CHECK: Int-unbox
@@ -7,7 +7,7 @@ class C<T> {
fun foo(x: T) = x
}
// CHECK: define void @"kfun:#main(){}"()
// CHECK-LABEL: define void @"kfun:#main(){}"()
// CHECK-NOT: Int-box
// TODO Remove next check after fix of https://youtrack.jetbrains.com/issue/KT-53100/Optimization-needed-T-unboxCONSTANTPRIMITIVEx-T-x
// CHECK: Int-unbox
@@ -3,7 +3,7 @@
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
// CHECK: define internal void @"kfun:$foo$FUNCTION_REFERENCE$0.<init>#internal"
// CHECK-LABEL: define internal void @"kfun:$foo$FUNCTION_REFERENCE$0.<init>#internal"
// CHECK-SAME: i32
fun <T> T.foo() { println(this) }
@@ -9,7 +9,7 @@ fun interface Foo {
fun baz(x: Any): Int = x.hashCode()
// CHECK: define void @"kfun:#main(){}"()
// CHECK-LABEL: define void @"kfun:#main(){}"()
// Boxing needs to be used now due to non-devirtualized call
// CHECK: Int-box
@@ -9,7 +9,7 @@ fun interface Foo<T> {
fun baz(x: Any): Int = x.hashCode()
// CHECK: define void @"kfun:#main(){}"()
// CHECK-LABEL: define void @"kfun:#main(){}"()
// CHECK-NOT: Int-box
// CHECK-NOT: Int-unbox
// CHECK: ret void
@@ -9,7 +9,7 @@ fun interface Foo {
fun baz(x: Int): Int = x.hashCode()
// CHECK: define void @"kfun:#main(){}"()
// CHECK-LABEL: define void @"kfun:#main(){}"()
// CHECK-NOT: Int-box
// CHECK-NOT: Int-unbox
// CHECK: ret void
@@ -9,7 +9,7 @@ fun interface Foo<T> {
fun baz(x: Any): Int = x.hashCode()
// CHECK: define void @"kfun:#main(){}"()
// CHECK-LABEL: define void @"kfun:#main(){}"()
// CHECK-NOT: Int-box
// CHECK-NOT: Int-unbox
// CHECK: ret void
@@ -5,7 +5,7 @@
fun plus1(x: Int) = x + 1
// CHECK: define void @"kfun:#main(){}"()
// CHECK-LABEL: define void @"kfun:#main(){}"()
// CHECK-NOT: Int-box
// CHECK-NOT: Int-unbox
// CHECK: ret void