Remove checking if the instruction is in the preheader or exit blocks. Those checks are redundant and handled by checking if the instruction is outside the loop below. Split off as suggested from https://github.com/llvm/llvm-project/pull/137709.