[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:
+8
-1
@@ -81,12 +81,19 @@ enum class EvaluationMode {
|
|||||||
override fun canEvaluateExpression(expression: IrExpression): Boolean {
|
override fun canEvaluateExpression(expression: IrExpression): Boolean {
|
||||||
if (expression !is IrCall) return false
|
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 expression.symbol.owner.fqNameWhenAvailable?.asString() == "kotlin.String.plus"
|
||||||
}
|
}
|
||||||
|
|
||||||
return true
|
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 {
|
ONLY_INTRINSIC_CONST {
|
||||||
|
|||||||
Reference in New Issue
Block a user