Add post-module-writing opt stage

This didn't turn out to be that much use though.
Only check heap allocations once if we can find a check that obviously dominates all others.

Also fix a bug gathering specialised predecessors exposed by that change. This dramatically reduces code produced for Mongoose example.