st/mesa: do most of GLSL lowering outside of the optimization do-while loop