Added explicit branch to otherwise unterminated basic blocks in llpython.byte_translator.

This commit is contained in:
Jon Riehl 2013-01-29 16:44:03 -06:00
commit b895f1fc99

View file

@ -225,6 +225,12 @@ class LLVMTranslator (BytecodeFlowVisitor):
return ret_val
def exit_block (self, block):
bb_instrs = self.llvm_block.instructions
if ((len(bb_instrs) == 0) or
(not bb_instrs[-1].is_terminator)):
out_blocks = list(self.cfg.blocks_out[block])
assert len(out_blocks) == 1
self.builder.branch(self.llvm_blocks[out_blocks[0]])
del self.llvm_block
del self.builder