ForLoopsLowering: Use last-exclusive for-loops for optimized until

progressions instead of decrementing "last".

#KT-41352 Fixed
This commit is contained in:
Mark Punzalan
2020-10-08 06:20:25 +00:00
committed by Alexander Udalov
parent 1adb130509
commit ccbf7cc2ee
28 changed files with 98 additions and 606 deletions
@@ -19,26 +19,25 @@ 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.
// JVM non-IR optimizes out all reversed() calls. However, this has a bug (KT-42533).
// JVM IR optimizes out the 2nd reversed() call.
// 0 reversed
// 0 iterator
// 0 getStart
// 0 getEnd
// JVM_TEMPLATES
// 0 reversed
// 0 getFirst
// 0 getLast
// 0 getStep
// JVM_TEMPLATES
// 2 IF_ICMPGE
// 1 IFGE
// 3 IF
// 1 LCMP
// JVM_IR_TEMPLATES
// 2 IF_ICMPLE
// 1 IFGT
// 1 IFLE
// 4 IF
// 2 LCMP
// 3 reversed
// 3 getFirst
// 3 getLast
// 3 getStep
@@ -19,26 +19,25 @@ 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.
// JVM non-IR optimizes out all reversed() calls. However, this has a bug (KT-42533).
// JVM IR optimizes out the 2nd reversed() call.
// 0 reversed
// 0 iterator
// 0 getStart
// 0 getEnd
// JVM_TEMPLATES
// 0 reversed
// 0 getFirst
// 0 getLast
// 0 getStep
// JVM_TEMPLATES
// 2 IF_ICMPLT
// 1 IFLT
// 3 IF
// 1 LCMP
// JVM_IR_TEMPLATES
// 2 IF_ICMPLE
// 1 IFGT
// 1 IFLE
// 4 IF
// 2 LCMP
// 3 reversed
// 3 getFirst
// 3 getLast
// 3 getStep