From 8a033138186c75e4f57c7f03a6a3489558682028 Mon Sep 17 00:00:00 2001 From: Igor Chevdar Date: Mon, 31 Oct 2022 08:47:12 +0200 Subject: [PATCH] [K/N][optmz] Fixed a minor bug with DataFlowIR Because of the bug, hanging (detached from the graph) NewObject nodes would be created. The escape analysis algorithm then happily would decide to allocate them on the stack, thus spoiling the statistics about actual percentage of objects allocated on the stack. --- .../kotlin/backend/konan/optimizations/DFGBuilder.kt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/optimizations/DFGBuilder.kt b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/optimizations/DFGBuilder.kt index a9110a5d654..98d619f270d 100644 --- a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/optimizations/DFGBuilder.kt +++ b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/optimizations/DFGBuilder.kt @@ -309,6 +309,15 @@ internal class ModuleDFGBuilder(val context: Context, val irModule: IrModuleFrag expressions += expression to currentLoop } + if (expression is IrCall && expression.symbol == initInstanceSymbol) { + // Skip the constructor call as initInstance is handled specially later. + val thiz = expression.getValueArgument(0)!! + val constructorCall = expression.getValueArgument(1)!! + thiz.acceptVoid(this) + constructorCall.acceptChildrenVoid(this) + return + } + if (expression is IrCall && expression.symbol == executeImplSymbol) { // Producer and job of executeImpl are called externally, we need to reflect this somehow. val producerInvocation = IrCallImpl.fromSymbolDescriptor(expression.startOffset, expression.endOffset,