Search code examples
llvmllvm-c++-api

llvm: how to replace function A to another function using llvm api?


I want to replace "function A" call to "function B" call. Currently, I've inserted "function B", I think ReplaceInstWithInst() may help, however, I don't know how to locate "function A". How should I do?


Solution

  • You can access all the functions in a module by using mod->getFunction("functionA");, as described here.