Change the conditions of the two outer if statements to test optimize: if (optimize && GET_CODE (insn) == JUMP_INSN) if (optimize && LABEL_NUSES (insn) == 1)