JVM_IR generate range loops as counter loops when possible
This commit is contained in:
committed by
teamcityserver
parent
d0f207071c
commit
38d6c8ded0
+1
-8
@@ -6,22 +6,15 @@ fun test(s: CharSequence): Int {
|
||||
return result
|
||||
}
|
||||
|
||||
// JVM non-IR uses while.
|
||||
// JVM IR uses if + do-while.
|
||||
|
||||
// 0 iterator
|
||||
// 0 getStart
|
||||
// 0 getEnd
|
||||
// 0 getFirst
|
||||
// 0 getLast
|
||||
|
||||
// JVM_TEMPLATES
|
||||
// 0 IF_ICMPGT
|
||||
// 0 IF_ICMPEQ
|
||||
// 0 IF_ICMPLE
|
||||
// 1 IF_ICMPGE
|
||||
// 1 IF
|
||||
|
||||
// JVM_IR_TEMPLATES
|
||||
// 1 IF_ICMPGT
|
||||
// 1 IF_ICMPLE
|
||||
// 2 IF
|
||||
|
||||
compiler/testData/codegen/bytecodeText/forLoop/forInIndices/forInCharSequenceTypeParameterIndices.kt
Vendored
+1
-9
@@ -6,9 +6,6 @@ fun <T : CharSequence> test(s: T): Int {
|
||||
return result
|
||||
}
|
||||
|
||||
// JVM non-IR uses while.
|
||||
// JVM IR uses if + do-while.
|
||||
|
||||
// 0 iterator
|
||||
// 0 getStart
|
||||
// 0 getEnd
|
||||
@@ -16,13 +13,8 @@ fun <T : CharSequence> test(s: T): Int {
|
||||
// 0 getLast
|
||||
// 1 INVOKEINTERFACE java/lang/CharSequence\.length \(\)I
|
||||
|
||||
// JVM_TEMPLATES
|
||||
// 0 IF_ICMPGT
|
||||
// 0 IF_ICMPEQ
|
||||
// 0 IF_ICMPLE
|
||||
// 1 IF_ICMPGE
|
||||
// 1 IF
|
||||
|
||||
// JVM_IR_TEMPLATES
|
||||
// 1 IF_ICMPGT
|
||||
// 1 IF_ICMPLE
|
||||
// 2 IF
|
||||
|
||||
+2
-9
@@ -12,14 +12,7 @@ fun Collection<Int>.sumIndices(): Int {
|
||||
// 0 getFirst
|
||||
// 0 getLast
|
||||
|
||||
// JVM non-IR uses while.
|
||||
// JVM IR uses if + do-while.
|
||||
|
||||
// JVM_TEMPLATES
|
||||
// 1 IF_ICMPGE
|
||||
// 0 IF_ICMPGT
|
||||
// 0 IF_ICMPLE
|
||||
// 1 IF
|
||||
|
||||
// JVM_IR_TEMPLATES
|
||||
// 1 IF_ICMPGT
|
||||
// 1 IF_ICMPLE
|
||||
// 2 IF
|
||||
|
||||
+2
-9
@@ -11,14 +11,7 @@ fun test() {
|
||||
// 0 getFirst
|
||||
// 0 getLast
|
||||
|
||||
// JVM non-IR uses while.
|
||||
// JVM IR uses if + do-while.
|
||||
|
||||
// JVM_TEMPLATES
|
||||
// 1 IF_ICMPGE
|
||||
// 0 IF_ICMPGT
|
||||
// 0 IF_ICMPLE
|
||||
// 1 IF
|
||||
|
||||
// JVM_IR_TEMPLATES
|
||||
// 1 IF_ICMPGT
|
||||
// 1 IF_ICMPLE
|
||||
// 2 IF
|
||||
|
||||
Vendored
+2
-9
@@ -12,14 +12,7 @@ fun <T : Collection<*>> test(c: T) {
|
||||
// 0 getLast
|
||||
// 1 INVOKEINTERFACE java/util/Collection\.size \(\)I
|
||||
|
||||
// JVM non-IR uses while.
|
||||
// JVM IR uses if + do-while.
|
||||
|
||||
// JVM_TEMPLATES
|
||||
// 1 IF_ICMPGE
|
||||
// 0 IF_ICMPGT
|
||||
// 0 IF_ICMPLE
|
||||
// 1 IF
|
||||
|
||||
// JVM_IR_TEMPLATES
|
||||
// 1 IF_ICMPGT
|
||||
// 1 IF_ICMPLE
|
||||
// 2 IF
|
||||
|
||||
+2
-9
@@ -5,20 +5,13 @@ fun test() {
|
||||
}
|
||||
}
|
||||
|
||||
// JVM non-IR uses while.
|
||||
// JVM IR uses if + do-while.
|
||||
|
||||
// 0 iterator
|
||||
// 0 getStart
|
||||
// 0 getEnd
|
||||
// 0 getFirst
|
||||
// 0 getLast
|
||||
|
||||
// JVM_TEMPLATES
|
||||
// 1 IF_ICMPGE
|
||||
// 0 IF_ICMPGT
|
||||
// 0 IF_ICMPLE
|
||||
// 1 IF
|
||||
|
||||
// JVM_IR_TEMPLATES
|
||||
// 1 IF_ICMPGT
|
||||
// 1 IF_ICMPLE
|
||||
// 2 IF
|
||||
+2
-9
@@ -5,20 +5,13 @@ fun test() {
|
||||
}
|
||||
}
|
||||
|
||||
// JVM non-IR uses while.
|
||||
// JVM IR uses if + do-while.
|
||||
|
||||
// 0 iterator
|
||||
// 0 getStart
|
||||
// 0 getEnd
|
||||
// 0 getFirst
|
||||
// 0 getLast
|
||||
|
||||
// JVM_TEMPLATES
|
||||
// 1 IF_ICMPGE
|
||||
// 0 IF_ICMPGT
|
||||
// 0 IF_ICMPLE
|
||||
// 1 IF
|
||||
|
||||
// JVM_IR_TEMPLATES
|
||||
// 1 IF_ICMPGT
|
||||
// 1 IF_ICMPLE
|
||||
// 2 IF
|
||||
@@ -8,19 +8,17 @@ fun test(): Int {
|
||||
return sum
|
||||
}
|
||||
|
||||
// JVM non-IR uses while.
|
||||
// JVM IR uses if + do-while. The surrounding "if" gets optimized in this test (constant condition).
|
||||
|
||||
// 0 iterator
|
||||
// 0 getStart
|
||||
// 0 getEnd
|
||||
// 0 getFirst
|
||||
// 0 getLast
|
||||
// 0 getStep
|
||||
// 1 IF
|
||||
|
||||
// JVM_TEMPLATES
|
||||
// 1 IF_ICMPGT
|
||||
// 1 IF
|
||||
|
||||
// JVM_IR_TEMPLATES
|
||||
// 1 IF_ICMPLE
|
||||
// 1 IF_ICMPGE
|
||||
// 1 IF
|
||||
@@ -8,19 +8,17 @@ fun test(): Int {
|
||||
return sum
|
||||
}
|
||||
|
||||
// JVM non-IR uses while.
|
||||
// JVM IR uses if + do-while. The surrounding "if" gets optimized in this test (constant condition).
|
||||
|
||||
// 0 iterator
|
||||
// 0 getStart
|
||||
// 0 getEnd
|
||||
// 0 getFirst
|
||||
// 0 getLast
|
||||
// 0 getStep
|
||||
// 1 IF
|
||||
|
||||
// JVM_TEMPLATES
|
||||
// 1 IF_ICMPGT
|
||||
// 1 IF
|
||||
|
||||
// JVM_IR_TEMPLATES
|
||||
// 1 IF_ICMPLE
|
||||
// 1 IF_ICMPGE
|
||||
// 1 IF
|
||||
@@ -8,24 +8,22 @@ fun test(): Long {
|
||||
return sum
|
||||
}
|
||||
|
||||
// JVM non-IR uses while.
|
||||
// JVM IR uses if + do-while.
|
||||
|
||||
// 0 iterator
|
||||
// 0 getStart
|
||||
// 0 getEnd
|
||||
// 0 getFirst
|
||||
// 0 getLast
|
||||
// 0 getStep
|
||||
// 1 IFGT
|
||||
|
||||
// 0 L2I
|
||||
// 0 I2L
|
||||
|
||||
// JVM_TEMPLATES
|
||||
// 1 IFGT
|
||||
// 1 LCMP
|
||||
// 1 IF
|
||||
|
||||
// JVM_IR_TEMPLATES
|
||||
// 2 LCMP
|
||||
// 1 IFLE
|
||||
// 2 IF
|
||||
// 1 LCMP
|
||||
// 1 IFGE
|
||||
// 1 IF
|
||||
+3
-5
@@ -11,19 +11,17 @@ fun test(): Int {
|
||||
return s
|
||||
}
|
||||
|
||||
// JVM non-IR uses while.
|
||||
// JVM IR uses if + do-while. The surrounding "if" gets optimized in this test (constant condition).
|
||||
|
||||
// 0 iterator
|
||||
// 0 getStart
|
||||
// 0 getEnd
|
||||
// 0 getFirst
|
||||
// 0 getLast
|
||||
// 0 getStep
|
||||
// 1 IF
|
||||
|
||||
// JVM_TEMPLATES
|
||||
// 1 IF_ICMPGT
|
||||
// 1 IF
|
||||
|
||||
// JVM_IR_TEMPLATES
|
||||
// 1 IF_ICMPLE
|
||||
// 1 IF_ICMPGE
|
||||
// 1 IF
|
||||
-3
@@ -11,9 +11,6 @@ fun box(): String {
|
||||
return "OK"
|
||||
}
|
||||
|
||||
// JVM non-IR uses while.
|
||||
// JVM IR uses if + do-while.
|
||||
|
||||
// 0 reversed
|
||||
// 0 iterator
|
||||
// 0 getStart
|
||||
|
||||
Vendored
-3
@@ -11,9 +11,6 @@ fun box(): String {
|
||||
return "OK"
|
||||
}
|
||||
|
||||
// JVM non-IR uses while.
|
||||
// JVM IR uses if + do-while.
|
||||
|
||||
// 0 reversed
|
||||
// 0 iterator
|
||||
// 0 getStart
|
||||
|
||||
Vendored
-3
@@ -11,9 +11,6 @@ fun box(): String {
|
||||
return "OK"
|
||||
}
|
||||
|
||||
// JVM non-IR uses while.
|
||||
// JVM IR uses if + do-while.
|
||||
|
||||
// 0 reversed
|
||||
// 0 iterator
|
||||
// 0 getStart
|
||||
|
||||
-3
@@ -22,9 +22,6 @@ fun box(): String {
|
||||
return "OK"
|
||||
}
|
||||
|
||||
// JVM non-IR uses while.
|
||||
// JVM IR uses if + do-while. The surrounding "if" gets optimized in this test (constant condition), except for Long.
|
||||
|
||||
// 0 reversed
|
||||
// 0 iterator
|
||||
// 0 getStart
|
||||
|
||||
-3
@@ -22,9 +22,6 @@ fun box(): String {
|
||||
return "OK"
|
||||
}
|
||||
|
||||
// JVM non-IR uses while.
|
||||
// JVM IR uses if + do-while. The surrounding "if" gets optimized in this test (constant condition), except for Long.
|
||||
|
||||
// 0 reversed
|
||||
// 0 iterator
|
||||
// 0 getStart
|
||||
|
||||
+1
-9
@@ -6,9 +6,6 @@ fun test(a: Char, b: Char): String {
|
||||
return s
|
||||
}
|
||||
|
||||
// JVM non-IR uses while.
|
||||
// JVM IR uses if + do-while.
|
||||
|
||||
// 0 iterator
|
||||
// 0 getStart
|
||||
// 0 getEnd
|
||||
@@ -16,11 +13,6 @@ fun test(a: Char, b: Char): String {
|
||||
// 0 getLast
|
||||
// 0 getStep
|
||||
|
||||
// JVM_TEMPLATES
|
||||
// 1 IF_ICMPGE
|
||||
// 0 IF_ICMPLT
|
||||
// 1 IF
|
||||
|
||||
// JVM_IR_TEMPLATES
|
||||
// 1 IF_ICMPGE
|
||||
// 1 IF_ICMPLT
|
||||
// 2 IF
|
||||
+1
-9
@@ -8,9 +8,6 @@ fun f(a: Char): Int {
|
||||
return n
|
||||
}
|
||||
|
||||
// JVM non-IR uses while.
|
||||
// JVM IR uses if + do-while.
|
||||
|
||||
// 0 iterator
|
||||
// 0 getStart
|
||||
// 0 getEnd
|
||||
@@ -18,11 +15,6 @@ fun f(a: Char): Int {
|
||||
// 0 getLast
|
||||
// 0 getStep
|
||||
|
||||
// JVM_TEMPLATES
|
||||
// 1 IF_ICMPGE
|
||||
// 0 IF_ICMPLT
|
||||
// 1 IF
|
||||
|
||||
// JVM_IR_TEMPLATES
|
||||
// 1 IF_ICMPGE
|
||||
// 1 IF_ICMPLT
|
||||
// 2 IF
|
||||
+2
-8
@@ -8,9 +8,6 @@ fun f(a: Char): Int {
|
||||
return n
|
||||
}
|
||||
|
||||
// JVM non-IR uses while.
|
||||
// JVM IR uses if + do-while.
|
||||
|
||||
// 0 iterator
|
||||
// 0 getStart
|
||||
// 0 getEnd
|
||||
@@ -18,8 +15,5 @@ fun f(a: Char): Int {
|
||||
// 0 getLast
|
||||
// 0 getStep
|
||||
|
||||
// JVM_TEMPLATES
|
||||
// 1 IF
|
||||
|
||||
// JVM_IR_TEMPLATES
|
||||
// 2 IF
|
||||
// 1 IFGE
|
||||
// 1 IF
|
||||
@@ -6,9 +6,6 @@ fun test(a: Int, b: Int): Int {
|
||||
return sum
|
||||
}
|
||||
|
||||
// JVM non-IR uses while.
|
||||
// JVM IR uses if + do-while.
|
||||
|
||||
// 0 iterator
|
||||
// 0 getStart
|
||||
// 0 getEnd
|
||||
@@ -16,11 +13,5 @@ fun test(a: Int, b: Int): Int {
|
||||
// 0 getLast
|
||||
// 0 getStep
|
||||
|
||||
// JVM_TEMPLATES
|
||||
// 1 IF_ICMPGE
|
||||
// 1 IF
|
||||
|
||||
// JVM_IR_TEMPLATES
|
||||
// 1 IF_ICMPGE
|
||||
// 1 IF_ICMPLT
|
||||
// 2 IF
|
||||
-9
@@ -8,9 +8,6 @@ fun f(a: Int): Int {
|
||||
return n
|
||||
}
|
||||
|
||||
// JVM non-IR uses while.
|
||||
// JVM IR uses if + do-while.
|
||||
|
||||
// 0 iterator
|
||||
// 0 getStart
|
||||
// 0 getEnd
|
||||
@@ -18,11 +15,5 @@ fun f(a: Int): Int {
|
||||
// 0 getLast
|
||||
// 0 getStep
|
||||
|
||||
// JVM_TEMPLATES
|
||||
// 1 IF_ICMPGE
|
||||
// 1 IF
|
||||
|
||||
// JVM_IR_TEMPLATES
|
||||
// 1 IF_ICMPGE
|
||||
// 1 IF_ICMPLT
|
||||
// 2 IF
|
||||
+1
-4
@@ -18,8 +18,5 @@ fun f(a: Int): Int {
|
||||
// 0 getLast
|
||||
// 0 getStep
|
||||
|
||||
// JVM_TEMPLATES
|
||||
// 1 IF_ICMPGE
|
||||
// 1 IF
|
||||
|
||||
// JVM_IR_TEMPLATES
|
||||
// 2 IF
|
||||
|
||||
@@ -6,9 +6,6 @@ fun test(a: Long, b: Long): Long {
|
||||
return sum
|
||||
}
|
||||
|
||||
// JVM non-IR uses while.
|
||||
// JVM IR uses if + do-while.
|
||||
|
||||
// 0 iterator
|
||||
// 0 getStart
|
||||
// 0 getEnd
|
||||
@@ -16,13 +13,6 @@ fun test(a: Long, b: Long): Long {
|
||||
// 0 getLast
|
||||
// 0 getStep
|
||||
|
||||
// JVM_TEMPLATES
|
||||
// 1 LCMP
|
||||
// 1 IFGE
|
||||
// 1 IF
|
||||
|
||||
// JVM_IR_TEMPLATES
|
||||
// 2 LCMP
|
||||
// 1 IFGE
|
||||
// 1 IFLT
|
||||
// 2 IF
|
||||
-10
@@ -8,9 +8,6 @@ fun f(a: Long): Int {
|
||||
return n
|
||||
}
|
||||
|
||||
// JVM non-IR uses while.
|
||||
// JVM IR uses if + do-while.
|
||||
|
||||
// 0 iterator
|
||||
// 0 getStart
|
||||
// 0 getEnd
|
||||
@@ -18,13 +15,6 @@ fun f(a: Long): Int {
|
||||
// 0 getLast
|
||||
// 0 getStep
|
||||
|
||||
// JVM_TEMPLATES
|
||||
// 1 LCMP
|
||||
// 1 IFGE
|
||||
// 1 IF
|
||||
|
||||
// JVM_IR_TEMPLATES
|
||||
// 2 LCMP
|
||||
// 1 IFGE
|
||||
// 1 IFLT
|
||||
// 2 IF
|
||||
+1
-7
@@ -8,9 +8,6 @@ fun f(a: Long): Int {
|
||||
return n
|
||||
}
|
||||
|
||||
// JVM non-IR uses while.
|
||||
// JVM IR uses if + do-while.
|
||||
|
||||
// 0 iterator
|
||||
// 0 getStart
|
||||
// 0 getEnd
|
||||
@@ -18,8 +15,5 @@ fun f(a: Long): Int {
|
||||
// 0 getLast
|
||||
// 0 getStep
|
||||
|
||||
// JVM_TEMPLATES
|
||||
// 1 IFGE
|
||||
// 1 IF
|
||||
|
||||
// JVM_IR_TEMPLATES
|
||||
// 2 IF
|
||||
|
||||
@@ -3,19 +3,18 @@ fun f() {
|
||||
}
|
||||
}
|
||||
|
||||
// JVM non-IR uses while.
|
||||
// JVM IR uses if + do-while. The surrounding "if" gets optimized in this test (constant condition).
|
||||
|
||||
// 0 iterator
|
||||
// 0 getStart
|
||||
// 0 getEnd
|
||||
// 0 getFirst
|
||||
// 0 getLast
|
||||
// 0 getStep
|
||||
// 1 IF
|
||||
|
||||
|
||||
// JVM_TEMPLATES
|
||||
// 1 IF_ICMPGT
|
||||
// 1 IF
|
||||
|
||||
// JVM_IR_TEMPLATES
|
||||
// 1 IF_ICMPLE
|
||||
// 1 IF_ICMPGE
|
||||
// 1 IF
|
||||
|
||||
+2
-6
@@ -9,9 +9,6 @@ fun f(a: UInt): Int {
|
||||
return n
|
||||
}
|
||||
|
||||
// JVM non-IR uses while.
|
||||
// JVM IR uses if + do-while.
|
||||
|
||||
// 0 iterator
|
||||
// 0 getStart
|
||||
// 0 getEnd
|
||||
@@ -27,7 +24,6 @@ fun f(a: UInt): Int {
|
||||
// 1 IF
|
||||
|
||||
// JVM_IR_TEMPLATES
|
||||
// 2 INVOKESTATIC kotlin/UnsignedKt.uintCompare
|
||||
// 1 INVOKESTATIC kotlin/UnsignedKt.uintCompare
|
||||
// 1 IFGE
|
||||
// 1 IFLT
|
||||
// 2 IF
|
||||
// 1 IF
|
||||
+1
-1
@@ -25,4 +25,4 @@ fun f(a: UInt): Int {
|
||||
// 1 IF
|
||||
|
||||
// JVM_IR_TEMPLATES
|
||||
// 2 IF
|
||||
// 1 IF
|
||||
|
||||
+2
-3
@@ -27,7 +27,6 @@ fun f(a: ULong): Int {
|
||||
// 1 IF
|
||||
|
||||
// JVM_IR_TEMPLATES
|
||||
// 2 INVOKESTATIC kotlin/UnsignedKt.ulongCompare
|
||||
// 1 INVOKESTATIC kotlin/UnsignedKt.ulongCompare
|
||||
// 1 IFGE
|
||||
// 1 IFLT
|
||||
// 2 IF
|
||||
// 1 IF
|
||||
+1
-1
@@ -25,4 +25,4 @@ fun f(a: ULong): Int {
|
||||
// 1 IF
|
||||
|
||||
// JVM_IR_TEMPLATES
|
||||
// 2 IF
|
||||
// 1 IF
|
||||
|
||||
Reference in New Issue
Block a user