Modifying GlobalVariable in LLVM IR

Hi Team,
I am trying a simple LLVM pass which changes the statement

From : @.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
To : @.str = private unnamed_addr constant [5 x i8] c"%19s\00", align 1

The “From” statement is fetched from the IR using the below code. And it prints fine.
GlobalVariable *gVar = dyn_cast(const_expr->getOperand(0));

I am trying to change with something like the below, but doesn’t seem working.
Value *constant = Builder.CreateGlobalString("[3 x i8] c"%19s\00"", “String1a”);

Any suggestions please. Thanks.

Create a new global, then create a constant expression adjusting the type (from [3 x i8]* to [5 x i8]*), then call replaceAllUses on the original global with the constant expression. The original global can after be deleted.

Thanks. Will try creating a new global replacing the existing one (though I am relatively new to IR). Will update here with the results. Thanks again.

That worked. Thanks.