[llvm-dev] Copy Function from one LLVM IR file to another

Tim Northover via llvm-dev llvm-dev at lists.llvm.org
Sun May 19 03:58:39 PDT 2019


Hi Kell,

On Sun, 19 May 2019 at 07:51, Kell Maresh <kell.maresh09 at gmail.com> wrote:
> Thanks a lot for your response. I was successfully able to use CloneFunctionInto for copying the function over when the number of arguments to both the functions are same. Can CloneFunctionInto be used when the number of arguments of the functions are not equal? If yes, how do I provide the ValueToValueMapTy &VMap argument to the CloneIntoFunction in that case?

It's certainly possible, but how you map the arguments depends
entirely on how you want this new function to behave. They need to be
compatible in some way you understand for the operation to make any
sense at all, and that compatibility ought to tell you how to map the
arguments.

If actually making sense isn't important for some reason, you could
map all extra arguments to undef. But the resulting function shouldn't
be expected to do anything useful.

Cheers.

Tim.


More information about the llvm-dev mailing list