An optimal control perspective on diffusion-based generative modeling