# HG changeset patch # User Christian Kamm # Date 1217077257 -7200 # Node ID 71a40b62b408d9a8e86b9c0e22e68bf5219ec64f # Parent 1d351cd26a5aec30a65760b8cda2b337b4a6d7a5 Start a new basic block after a continue statement. Fixes bug_d_irstate_244_A/b. diff -r 1d351cd26a5a -r 71a40b62b408 gen/statements.cpp --- a/gen/statements.cpp Fri Jul 25 00:39:24 2008 +0200 +++ b/gen/statements.cpp Sat Jul 26 15:00:57 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); } //////////////////////////////////////////////////////////////////////////////