Integrate some changes from upstream cgen that tightened up the generated output. Shouldn't be any functional changes here.