Optimization of save/restore usage