Minor: JvmBuiltinOptimizationLowering.kt: reformat & fix warnings
This commit is contained in:
+18
-14
@@ -53,19 +53,22 @@ class JvmBuiltinOptimizationLowering(val context: JvmBackendContext) : FileLower
|
|||||||
dispatchReceiverParameter != null
|
dispatchReceiverParameter != null
|
||||||
|
|
||||||
|
|
||||||
private fun getOperandsIfCallToEqeqOrEquals(call: IrCall): Pair<IrExpression, IrExpression>? {
|
private fun getOperandsIfCallToEqeqOrEquals(call: IrCall): Pair<IrExpression, IrExpression>? =
|
||||||
if (call.symbol == context.irBuiltIns.eqeqSymbol) {
|
when {
|
||||||
val left = call.getValueArgument(0)!!
|
call.symbol == context.irBuiltIns.eqeqSymbol -> {
|
||||||
val right = call.getValueArgument(1)!!
|
val left = call.getValueArgument(0)!!
|
||||||
return left to right
|
val right = call.getValueArgument(1)!!
|
||||||
} else if (call.symbol.owner.isObjectEquals) {
|
left to right
|
||||||
val left = call.dispatchReceiver!!
|
}
|
||||||
val right = call.getValueArgument(0)!!
|
|
||||||
return left to right
|
call.symbol.owner.isObjectEquals -> {
|
||||||
} else {
|
val left = call.dispatchReceiver!!
|
||||||
return null;
|
val right = call.getValueArgument(0)!!
|
||||||
|
left to right
|
||||||
|
}
|
||||||
|
|
||||||
|
else -> null
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
override fun lower(irFile: IrFile) {
|
override fun lower(irFile: IrFile) {
|
||||||
irFile.transformChildrenVoid(object : IrElementTransformerVoid() {
|
irFile.transformChildrenVoid(object : IrElementTransformerVoid() {
|
||||||
@@ -116,7 +119,7 @@ class JvmBuiltinOptimizationLowering(val context: JvmBackendContext) : FileLower
|
|||||||
val isCompilerGenerated = expression.origin == null
|
val isCompilerGenerated = expression.origin == null
|
||||||
expression.transformChildrenVoid(this)
|
expression.transformChildrenVoid(this)
|
||||||
// Remove all branches with constant false condition.
|
// Remove all branches with constant false condition.
|
||||||
expression.branches.removeIf() {
|
expression.branches.removeIf {
|
||||||
it.condition.isFalseConst() && isCompilerGenerated
|
it.condition.isFalseConst() && isCompilerGenerated
|
||||||
}
|
}
|
||||||
if (expression.origin == IrStatementOrigin.ANDAND) {
|
if (expression.origin == IrStatementOrigin.ANDAND) {
|
||||||
@@ -248,7 +251,8 @@ class JvmBuiltinOptimizationLowering(val context: JvmBackendContext) : FileLower
|
|||||||
if (first is IrVariable
|
if (first is IrVariable
|
||||||
&& first.origin == IrDeclarationOrigin.IR_TEMPORARY_VARIABLE
|
&& first.origin == IrDeclarationOrigin.IR_TEMPORARY_VARIABLE
|
||||||
&& second is IrGetValue
|
&& second is IrGetValue
|
||||||
&& first.symbol == second.symbol) {
|
&& first.symbol == second.symbol
|
||||||
|
) {
|
||||||
statements.clear()
|
statements.clear()
|
||||||
first.initializer?.let { statements.add(it) }
|
first.initializer?.let { statements.add(it) }
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user