[llvm-dev] How to modify constant global array?

於剑波 via llvm-dev llvm-dev at lists.llvm.org
Sat Apr 10 20:29:00 PDT 2021


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 :)


More information about the llvm-dev mailing list