[IR] Simplify unsigned check in EVALUATION_MODE

This way we are not creating useless intermediate lists. This change
speeds up backend by approximately 0.38%.
This commit is contained in:
Ivan Kylchik
2023-08-22 17:05:31 +02:00
committed by Space Team
parent f36f37bf47
commit 3335db0aa8
@@ -81,12 +81,19 @@ enum class EvaluationMode {
override fun canEvaluateExpression(expression: IrExpression): Boolean {
if (expression !is IrCall) return false
if (expression.getAllArgumentsWithIr().any { it.second?.type?.isUnsigned() == true }) {
if (expression.hasUnsignedArgs()) {
return expression.symbol.owner.fqNameWhenAvailable?.asString() == "kotlin.String.plus"
}
return true
}
private fun IrCall.hasUnsignedArgs(): Boolean {
fun IrExpression?.hasUnsignedType() = this != null && type.isUnsigned()
if (dispatchReceiver.hasUnsignedType() || extensionReceiver.hasUnsignedType()) return true
if ((0 until this.valueArgumentsCount).any { getValueArgument(it)?.type?.isUnsigned() == true }) return true
return false
}
},
ONLY_INTRINSIC_CONST {