Always finish basic block if it exists

This commit is contained in:
Igor Chevdar
2017-03-28 15:53:38 +03:00
parent 779976f2b1
commit 6f8d75a232
@@ -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!!)
}