Passing character array as argument in inserted function call during IR pass


I am trying to insert a function call inside a module during an LLVM IR pass. One of the arguments is a character array and I need to initialize it with a string during the IR pass. But I am not able to create a value object to use as the function argument. For example,

In my IR pass, I have the following : sringRef str(“StringValue”)

I want to insert the following call(FuncCall) in the source file being compiled.

void foo(){


Can someone please tell me how this can be done?


You can use IRBuilder::CreateGlobalStringPtr:

Hope this helps,