How to modify constant global array?

In my pass, I’d like to create a constant GV array, and append elements when i need. In my implementation, I collect and count original gv array elements, then create a new GV with a new ArrayRef<Constants *> initializer which has more elements and a bigger size.
But when I want to replaceAllUseWith new GV, assert failed due to non-matched type. Then I try to replace GEP which use the original GV with NewGEP, it still failed.

So are there some good practice to modify constant global array? or replace array GV with a new one which has a different type? Thx :slight_smile: