# HG changeset patch # User Christian Kamm # Date 1217077968 -7200 # Node ID b0feb180ce5544f6db762c3e96929478d5c7f1f3 # Parent 38979a6fe480ca8affc2edd5a4ef617f99594091# Parent 71a40b62b408d9a8e86b9c0e22e68bf5219ec64f Automated merge with http://hg.dsource.org/projects/llvmdc diff -r 38979a6fe480 -r b0feb180ce55 gen/statements.cpp --- 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); } //////////////////////////////////////////////////////////////////////////////