nir: add helper to copy const_index[]