Rematerialize simple expressions (local variables, literals, $this, $receiver) when generating calls.
This commit is contained in:
committed by
Dmitry Petrov
parent
c1583c4368
commit
287d804131
+2
-6
@@ -5,11 +5,7 @@ IrFile /arrayAssignment.kt
|
||||
VAR val x: kotlin.IntArray
|
||||
CALL .intArrayOf type=kotlin.IntArray operator=
|
||||
elements: DUMMY vararg type=kotlin.Int
|
||||
VAR val tmp0_array: kotlin.IntArray
|
||||
GET_VAR x type=kotlin.IntArray
|
||||
VAR val tmp1_index0: kotlin.Int
|
||||
LITERAL Int type=kotlin.Int value='1'
|
||||
CALL .set type=kotlin.Unit operator=EQ
|
||||
$this: GET_VAR tmp0_array type=kotlin.IntArray
|
||||
index: GET_VAR tmp1_index0 type=kotlin.Int
|
||||
$this: GET_VAR x type=kotlin.IntArray
|
||||
index: LITERAL Int type=kotlin.Int value='1'
|
||||
value: LITERAL Int type=kotlin.Int value='0'
|
||||
|
||||
+9
-15
@@ -10,27 +10,21 @@ IrFile /arrayAugmentedAssignment1.kt
|
||||
BLOCK type=<no-type> hasResult=false isDesugared=false
|
||||
VAR var x: kotlin.IntArray
|
||||
CALL .foo type=kotlin.IntArray operator=
|
||||
VAR val tmp0_array: kotlin.IntArray
|
||||
GET_VAR x type=kotlin.IntArray
|
||||
VAR val tmp1_index0: kotlin.Int
|
||||
LITERAL Int type=kotlin.Int value='0'
|
||||
CALL .set type=kotlin.Unit operator=PLUSEQ
|
||||
$this: GET_VAR tmp0_array type=kotlin.IntArray
|
||||
index: GET_VAR tmp1_index0 type=kotlin.Int
|
||||
$this: GET_VAR x type=kotlin.IntArray
|
||||
index: LITERAL Int type=kotlin.Int value='0'
|
||||
value: CALL .plus type=kotlin.Int operator=PLUSEQ
|
||||
$this: CALL .get type=kotlin.Int operator=PLUSEQ
|
||||
$this: GET_VAR tmp0_array type=kotlin.IntArray
|
||||
index: GET_VAR tmp1_index0 type=kotlin.Int
|
||||
$this: GET_VAR x type=kotlin.IntArray
|
||||
index: LITERAL Int type=kotlin.Int value='0'
|
||||
other: LITERAL Int type=kotlin.Int value='1'
|
||||
VAR val tmp2_array: kotlin.IntArray
|
||||
VAR val tmp0_array: kotlin.IntArray
|
||||
CALL .foo type=kotlin.IntArray operator=
|
||||
VAR val tmp3_index0: kotlin.Int
|
||||
LITERAL Int type=kotlin.Int value='0'
|
||||
CALL .set type=kotlin.Unit operator=MULTEQ
|
||||
$this: GET_VAR tmp2_array type=kotlin.IntArray
|
||||
index: GET_VAR tmp3_index0 type=kotlin.Int
|
||||
$this: GET_VAR tmp0_array type=kotlin.IntArray
|
||||
index: LITERAL Int type=kotlin.Int value='0'
|
||||
value: CALL .times type=kotlin.Int operator=MULTEQ
|
||||
$this: CALL .get type=kotlin.Int operator=MULTEQ
|
||||
$this: GET_VAR tmp2_array type=kotlin.IntArray
|
||||
index: GET_VAR tmp3_index0 type=kotlin.Int
|
||||
$this: GET_VAR tmp0_array type=kotlin.IntArray
|
||||
index: LITERAL Int type=kotlin.Int value='0'
|
||||
other: LITERAL Int type=kotlin.Int value='2'
|
||||
|
||||
@@ -4,16 +4,12 @@ IrFile /arrayAugmentedAssignment2.kt
|
||||
IrFunction public fun IB.test(/*0*/ a: IA): kotlin.Unit
|
||||
IrExpressionBody
|
||||
BLOCK type=<no-type> hasResult=false isDesugared=false
|
||||
VAR val tmp0_array: IA
|
||||
GET_VAR a type=IA
|
||||
VAR val tmp1_index0: kotlin.String
|
||||
LITERAL String type=kotlin.String value=''
|
||||
CALL .set type=kotlin.Unit operator=PLUSEQ
|
||||
$this: $RECEIVER of: test type=IB
|
||||
$receiver: GET_VAR tmp0_array type=IA
|
||||
index: GET_VAR tmp1_index0 type=kotlin.String
|
||||
$receiver: GET_VAR a type=IA
|
||||
index: LITERAL String type=kotlin.String value=''
|
||||
value: CALL .plus type=kotlin.Int operator=PLUSEQ
|
||||
$this: CALL .get type=kotlin.Int operator=PLUSEQ
|
||||
$this: GET_VAR tmp0_array type=IA
|
||||
index: GET_VAR tmp1_index0 type=kotlin.String
|
||||
$this: GET_VAR a type=IA
|
||||
index: LITERAL String type=kotlin.String value=''
|
||||
other: LITERAL Int type=kotlin.Int value='42'
|
||||
|
||||
@@ -9,4 +9,5 @@ fun reordered2() = 2
|
||||
fun test() {
|
||||
foo(a = noReorder1(), b = noReorder2())
|
||||
foo(b = reordered1(), a = reordered2())
|
||||
foo(b = 1, a = reordered2())
|
||||
}
|
||||
@@ -35,3 +35,8 @@ IrFile /callWithReorderedArguments.kt
|
||||
CALL .foo type=kotlin.Unit operator=
|
||||
a: GET_VAR tmp1_a type=kotlin.Int
|
||||
b: GET_VAR tmp0_b type=kotlin.Int
|
||||
VAR val tmp2_a: kotlin.Int
|
||||
CALL .reordered2 type=kotlin.Int operator=
|
||||
CALL .foo type=kotlin.Unit operator=
|
||||
a: GET_VAR tmp2_a type=kotlin.Int
|
||||
b: LITERAL Int type=kotlin.Int value='1'
|
||||
|
||||
Reference in New Issue
Block a user