// maybeImplicitBranch creates a branch from the current position to the // specified basic block, if and only if the current basic block's last // instruction is not a terminator. // // If dest is nil, then branch to the next basic block, if any. func (c *compiler) maybeImplicitBranch(dest llvm.BasicBlock) { currBlock := c.builder.GetInsertBlock() if in := currBlock.LastInstruction(); in.IsNil() || in.IsATerminatorInst().IsNil() { if dest.IsNil() { dest = llvm.NextBasicBlock(currBlock) if !dest.IsNil() { c.builder.CreateBr(dest) } } else { c.builder.CreateBr(dest) } } }