Fix bug where before_bb_exec_invalidate_opt would be executed multiple times.