Get occurrences for loops with 'break'/'continue' statements

We only use it twice, and at those call-sites, it's cleaner to relegate the check to this function.