Move logic to a new optimization.

Putting this in make_thunk is awkaward. Also the old code was modifing
the op and an node and chaning a node during make_thunk isn't very
logical.

no news