Reimplement the convolution optimization.

At some point this went missing from the repository.  I have no idea why.