From 494d825da5d3608fda829b47b3524a093659c6af Mon Sep 17 00:00:00 2001 From: Svyatoslav Scherbina Date: Thu, 2 Mar 2017 17:59:14 +0700 Subject: [PATCH] backend/codegen: improve break and continue support Do not rely on loop label. --- .../org/jetbrains/kotlin/backend/konan/llvm/IrToBitcode.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 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 706e174ff17..571e8b65079 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 @@ -320,14 +320,14 @@ internal class CodeGeneratorVisitor(val context: Context) : IrElementVisitorVoid val loopCheck = codegen.basicBlock() override fun genBreak(destination: IrBreak) { - if (destination.label == null || destination.label == loop.label) + if (destination.loop == loop) codegen.br(loopExit) else super.genBreak(destination) } override fun genContinue(destination: IrContinue) { - if (destination.label == null || destination.label == loop.label) + if (destination.loop == loop) codegen.br(loopCheck) else super.genContinue(destination)