LocalStackSlotAllocation: Turn one-iteration loop into if.

No functionality change.