merge loop and helper variables when their use ranges do not overlap