[IR] Normalize temp var names in Kotlin-like dump

^KT-61983 Fixed
This commit is contained in:
Vladimir Sukharev
2023-09-19 21:29:17 +02:00
committed by Space Team
parent 6c519488a6
commit bae8b283c7
199 changed files with 1599 additions and 2273 deletions
@@ -7,9 +7,9 @@ fun box(): String {
ieee754equals(arg0 = a.get(index = i), arg1 = x.next()).not() -> return "Fail " + i
}
{ // BLOCK
val <unary>: Int = i
i = <unary>.inc()
<unary>
val tmp_0: Int = i
i = tmp_0.inc()
tmp_0
}
}
return "OK"
@@ -7,9 +7,9 @@ fun box(): String {
ieee754equals(arg0 = a.get(index = i), arg1 = x.next()).not() -> return "Fail " + i
}
{ // BLOCK
val tmp0: Int = i
i = tmp0.inc()
tmp0
val tmp_0: Int = i
i = tmp_0.inc()
tmp_0
} /*~> Unit */
}
return "OK"
@@ -1,64 +0,0 @@
FILE fqName:<root> fileName:/kt24114.kt
FUN name:one visibility:public modality:FINAL <> () returnType:kotlin.Int
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun one (): kotlin.Int declared in <root>'
CONST Int type=kotlin.Int value=1
FUN name:two visibility:public modality:FINAL <> () returnType:kotlin.Int
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun two (): kotlin.Int declared in <root>'
CONST Int type=kotlin.Int value=2
FUN name:test1 visibility:public modality:FINAL <> () returnType:kotlin.Int
BLOCK_BODY
WHILE label=null origin=WHILE_LOOP
condition: CONST Boolean type=kotlin.Boolean value=true
body: BLOCK type=kotlin.Unit origin=null
BLOCK type=kotlin.Unit origin=WHEN
VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:kotlin.Int [val]
CALL 'public final fun one (): kotlin.Int declared in <root>' type=kotlin.Int origin=null
WHEN type=kotlin.Unit origin=WHEN
BRANCH
if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'val tmp_0: kotlin.Int declared in <root>.test1' type=kotlin.Int origin=null
arg1: CONST Int type=kotlin.Int value=1
then: BLOCK type=kotlin.Unit origin=null
BLOCK type=kotlin.Unit origin=WHEN
VAR IR_TEMPORARY_VARIABLE name:tmp_1 type:kotlin.Int [val]
CALL 'public final fun two (): kotlin.Int declared in <root>' type=kotlin.Int origin=null
WHEN type=kotlin.Unit origin=WHEN
BRANCH
if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'val tmp_1: kotlin.Int declared in <root>.test1' type=kotlin.Int origin=null
arg1: CONST Int type=kotlin.Int value=2
then: RETURN type=kotlin.Nothing from='public final fun test1 (): kotlin.Int declared in <root>'
CONST Int type=kotlin.Int value=2
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: RETURN type=kotlin.Nothing from='public final fun test1 (): kotlin.Int declared in <root>'
CONST Int type=kotlin.Int value=3
FUN name:test2 visibility:public modality:FINAL <> () returnType:kotlin.Int
BLOCK_BODY
WHILE label=null origin=WHILE_LOOP
condition: CONST Boolean type=kotlin.Boolean value=true
body: BLOCK type=kotlin.Unit origin=null
BLOCK type=kotlin.Unit origin=WHEN
VAR IR_TEMPORARY_VARIABLE name:tmp_2 type:kotlin.Int [val]
CALL 'public final fun one (): kotlin.Int declared in <root>' type=kotlin.Int origin=null
WHEN type=kotlin.Unit origin=WHEN
BRANCH
if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'val tmp_2: kotlin.Int declared in <root>.test2' type=kotlin.Int origin=null
arg1: CONST Int type=kotlin.Int value=1
then: BLOCK type=kotlin.Unit origin=WHEN
VAR IR_TEMPORARY_VARIABLE name:tmp_3 type:kotlin.Int [val]
CALL 'public final fun two (): kotlin.Int declared in <root>' type=kotlin.Int origin=null
WHEN type=kotlin.Unit origin=WHEN
BRANCH
if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'val tmp_3: kotlin.Int declared in <root>.test2' type=kotlin.Int origin=null
arg1: CONST Int type=kotlin.Int value=2
then: RETURN type=kotlin.Nothing from='public final fun test2 (): kotlin.Int declared in <root>'
CONST Int type=kotlin.Int value=2
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: RETURN type=kotlin.Nothing from='public final fun test2 (): kotlin.Int declared in <root>'
CONST Int type=kotlin.Int value=3
@@ -1,44 +0,0 @@
fun one(): Int {
return 1
}
fun two(): Int {
return 2
}
fun test1(): Int {
while (true) { // BLOCK
{ // BLOCK
val tmp0_subject: Int = one()
when {
EQEQ(arg0 = tmp0_subject, arg1 = 1) -> { // BLOCK
{ // BLOCK
val tmp1_subject: Int = two()
when {
EQEQ(arg0 = tmp1_subject, arg1 = 2) -> return 2
}
}
}
else -> return 3
}
}
}
}
fun test2(): Int {
while (true) { // BLOCK
{ // BLOCK
val tmp2_subject: Int = one()
when {
EQEQ(arg0 = tmp2_subject, arg1 = 1) -> { // BLOCK
val tmp3_subject: Int = two()
when {
EQEQ(arg0 = tmp3_subject, arg1 = 2) -> return 2
}
}
else -> return 3
}
}
}
}
+1
View File
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
fun one() = 1
fun two() = 2
+8 -8
View File
@@ -9,13 +9,13 @@ fun two(): Int {
fun test1(): Int {
while (true) { // BLOCK
{ // BLOCK
val tmp0_subject: Int = one()
val tmp_0: Int = one()
when {
EQEQ(arg0 = tmp0_subject, arg1 = 1) -> { // BLOCK
EQEQ(arg0 = tmp_0, arg1 = 1) -> { // BLOCK
{ // BLOCK
val tmp1_subject: Int = two()
val tmp_1: Int = two()
when {
EQEQ(arg0 = tmp1_subject, arg1 = 2) -> return 2
EQEQ(arg0 = tmp_1, arg1 = 2) -> return 2
}
}
}
@@ -28,12 +28,12 @@ fun test1(): Int {
fun test2(): Int {
while (true) { // BLOCK
{ // BLOCK
val tmp0_subject: Int = one()
val tmp_2: Int = one()
when {
EQEQ(arg0 = tmp0_subject, arg1 = 1) -> { // BLOCK
val tmp1_subject: Int = two()
EQEQ(arg0 = tmp_2, arg1 = 1) -> { // BLOCK
val tmp_3: Int = two()
when {
EQEQ(arg0 = tmp1_subject, arg1 = 2) -> return 2
EQEQ(arg0 = tmp_3, arg1 = 2) -> return 2
}
}
else -> return 3