[IR] Support Collection<*>.indices in for loop lowering.

Unmute a couple of tests that are working as intended.
This commit is contained in:
Mads Ager
2019-08-30 15:17:21 +02:00
committed by Alexander Udalov
parent 76ab631214
commit 507857d452
5 changed files with 40 additions and 14 deletions
@@ -1,4 +1,3 @@
// IGNORE_BACKEND: JVM_IR
fun Collection<Int>.sumIndices(): Int {
var sum = 0
for (i in indices) {
@@ -13,6 +12,14 @@ fun Collection<Int>.sumIndices(): Int {
// 0 getFirst
// 0 getLast
// 0 IF_ICMPGT
// 0 IF_ICMPEQ
// JVM non-IR uses while.
// JVM IR uses if + do-while.
// JVM_TEMPLATES
// 1 IF_ICMPGE
// 1 IF
// JVM_IR_TEMPLATES
// 1 IF_ICMPGT
// 1 IF_ICMPLE
// 2 IF
@@ -1,4 +1,3 @@
// IGNORE_BACKEND: JVM_IR
fun test() {
var sum = 0
for (i in listOf(0, 0, 0, 0).indices) {
@@ -12,6 +11,14 @@ fun test() {
// 0 getFirst
// 0 getLast
// 0 IF_ICMPGT
// 0 IF_ICMPEQ
// JVM non-IR uses while.
// JVM IR uses if + do-while.
// JVM_TEMPLATES
// 1 IF_ICMPGE
// 1 IF
// JVM_IR_TEMPLATES
// 1 IF_ICMPGT
// 1 IF_ICMPLE
// 2 IF
@@ -1,4 +1,3 @@
// IGNORE_BACKEND: JVM_IR
fun test(): Int {
val intArray = intArrayOf(1, 2, 3)
var sum = 0
@@ -8,6 +7,21 @@ fun test(): Int {
return sum
}
// 0 iterator
// 0 getStart
// 0 getEnd
// 0 getFirst
// 0 getLast
// 0 getStep
// JVM non-IR uses while.
// JVM IR uses if + do-while.
// JVM_TEMPLATES
// 1 IF_ICMPGE
// 0 IF_ICMPGT
// 0 IF_ICMPEQ
// 1 IF
// JVM_IR_TEMPLATES
// 1 IF_ICMPGT
// 1 IF_ICMPNE
// 2 IF