changeset 396:b0feb180ce55

Automated merge with http://hg.dsource.org/projects/llvmdc
author Christian Kamm <kamm incasoftware de>
date Sat, 26 Jul 2008 15:12:48 +0200
parents 38979a6fe480 (current diff) 71a40b62b408 (diff)
children 9ec89aad9dbc
files
diffstat 1 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/gen/statements.cpp	Sat Jul 26 15:09:33 2008 +0200
+++ b/gen/statements.cpp	Sat Jul 26 15:12:48 2008 +0200
@@ -446,14 +446,16 @@
             targetLoopStatement = tmp->statement;
 
         // find the right continue block and jump there
+        bool found = false;
         IRState::LoopScopeVec::reverse_iterator it;
         for(it = gIR->loopbbs.rbegin(); it != gIR->loopbbs.rend(); ++it) {
             if(it->s == targetLoopStatement) {
                 llvm::BranchInst::Create(it->begin, gIR->scopebb());
-                return;
+                found = true;
+                break;
             }
         }
-        assert(0);
+        assert(found);
     }
     else {
         // can't 'continue' within switch, so omit them
@@ -466,6 +468,11 @@
         DtoEnclosingHandlers(enclosinghandler, it->enclosinghandler);
         llvm::BranchInst::Create(it->begin, gIR->scopebb());
     }
+
+    // the continue terminated this basicblock, start a new one
+    llvm::BasicBlock* oldend = gIR->scopeend();
+    llvm::BasicBlock* bb = llvm::BasicBlock::Create("aftercontinue", p->topfunc(), oldend);
+    p->scope() = IRScope(bb,oldend);
 }
 
 //////////////////////////////////////////////////////////////////////////////