From 6f8d75a232053d5df9ff60e62aeb77fb1fb691b1 Mon Sep 17 00:00:00 2001 From: Igor Chevdar Date: Tue, 28 Mar 2017 15:53:38 +0300 Subject: [PATCH] Always finish basic block if it exists --- .../kotlin/backend/konan/llvm/IrToBitcode.kt | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/IrToBitcode.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/IrToBitcode.kt index 85728355451..8644fcd034f 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/IrToBitcode.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/IrToBitcode.kt @@ -1442,13 +1442,14 @@ internal class CodeGeneratorVisitor(val context: Context) : IrElementVisitorVoid } } - if (!codegen.isAfterTerminator()) { // TODO should we solve this problem once and for all - if (inlinedFunctionScope.resultPhi != null) { - codegen.unreachable() - } - } - if (inlinedFunctionScope.bbExit != null) { + if (!codegen.isAfterTerminator()) { // TODO should we solve this problem once and for all + if (inlinedFunctionScope.resultPhi != null) { + codegen.unreachable() + } else { + codegen.br(inlinedFunctionScope.bbExit!!) + } + } codegen.positionAtEnd(inlinedFunctionScope.bbExit!!) }