Propagate the allow_gc flag in scan optimizations.

I hope I got all the spots. This is insane.