[JVM_IR] Avoid safe-call conversions from Byte? and Short? to Int? for
comparisons. Having those conversions leads to unnecesary boxing and null checks. This change does it only for JVM in the optimization lowering. It is unclear to me if the other backends can get away with something similar.
This commit is contained in:
+3
-5
@@ -1,5 +1,4 @@
|
||||
// !LANGUAGE: -ProperIeee754Comparisons
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
|
||||
fun equals3(a: Byte?, b: Byte?) = a != null && b != null && a == b
|
||||
|
||||
@@ -21,10 +20,9 @@ fun less5(a: Any?, b: Any?) = if (a is Byte && b is Byte) a < b else true
|
||||
// 0 IF_ICMPGE
|
||||
|
||||
// JVM_IR_TEMPLATES
|
||||
// 3 Intrinsics\.areEqual
|
||||
// 2 Intrinsics\.areEqual
|
||||
// 0 Intrinsics\.compare
|
||||
// 4 INVOKEVIRTUAL java/lang/Byte\.byteValue \(\)B
|
||||
// 2 INVOKEVIRTUAL java/lang/Number\.intValue \(\)I
|
||||
// 4 INVOKEVIRTUAL java/lang/Number\.byteValue \(\)B
|
||||
// 0 IFGE
|
||||
// 3 IF_ICMPGE
|
||||
// 0 IF_ICMPNE
|
||||
// 3 IF_ICMPGE
|
||||
Reference in New Issue
Block a user