[svn r288] Let return statements start a new basic block after terminating the current one.

This fixes problems such as

void main()
{ return; return; }
This commit is contained in:
Christian Kamm 2008-06-15 18:37:23 +02:00
parent 039664b249
commit 03888f4b07

View file

@ -140,6 +140,11 @@ void ReturnStatement::toIR(IRState* p)
if (global.params.symdebug) DtoDwarfFuncEnd(p->func()->decl);
llvm::ReturnInst::Create(p->scopebb());
}
// the return terminated this basicblock, start a new one
llvm::BasicBlock* oldend = gIR->scopeend();
llvm::BasicBlock* bb = llvm::BasicBlock::Create("afterreturn", p->topfunc(), oldend);
p->scope() = IRScope(bb,oldend);
}
//////////////////////////////////////////////////////////////////////////////