[llvm-dev] Function call replacement

zxhuan via llvm-dev llvm-dev at lists.llvm.org
Tue Mar 2 23:23:10 PST 2021


Hi all,

I am trying to replace calls to a function, say foo() with calls to
my_foo(). In the IR file, there is no call to foo(). However, foo() will be
called during execution. I can't use the conventional way to do it (i.e.
locate the call instruction, create a call site and then create a call to
my_foo(), then replace all uses with the return value of my_foo()), because
you can't locate the call instruction. So I tried to swap the name of foo()
and my_foo(). However, this only results in the original function with the
new name being called. I know I must have missed some steps, resulting in
the reference to the original function still existing after the renaming.
The question is, what is the missing step? Thank you so much for reading my
description. I hope I make my question clear.

Best,
Jason
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20210303/ca0fb80e/attachment.html>


More information about the llvm-dev mailing list