Model reduction algorithms for optimal control and importance sampling of diffusions