Files
kotlin/compiler/testData/codegen/bytecodeText/forLoop/unsigned/forInUntilUIntMinValue.kt
Mark Punzalan 177967258b ForLoopsLowering: Eliminate construction/boxing/unboxing of UInt/ULong.
This needs further cleanup to encapsulate more logic into ProgressionType.
2020-05-13 13:54:35 +02:00

30 lines
596 B
Kotlin
Vendored

// WITH_RUNTIME
const val M = UInt.MIN_VALUE
fun f(a: UInt): Int {
var n = 0
for (i in a until M) {
n++
}
return n
}
// For "until" progressions in JVM IR, there is a check that the range is not empty: upper bound != MIN_VALUE.
// When the upper bound == const MIN_VALUE, the backend can eliminate the entire loop as dead code.
// 0 iterator
// 0 getStart
// 0 getEnd
// 0 getFirst
// 0 getLast
// 0 getStep
// 0 INVOKESTATIC kotlin/UInt.constructor-impl
// 0 INVOKE\w+ kotlin/UInt.(un)?box-impl
// JVM_TEMPLATES
// 1 IF
// JVM_IR_TEMPLATES
// 0 IF
// 0 LINENUMBER 7