[LLVMdev] Cloning Functions

Eli Friedman eli.friedman at gmail.com
Wed Jul 9 10:16:07 PDT 2008


On Wed, Jul 9, 2008 at 9:56 AM, David Greene <dag at cray.com> wrote:
> I seem to recall havbing asked this before but I can't find it by searching.
>
> What's the right way to clone a Function?  I need to save off the text at a
> certain point and spit it out later, after other optimizations have run.  But
> I need to spit out the original text, not the optimized version.

You can use CloneFunction (in llvm/Transforms/Utils/Cloning.h) to
duplicate a function within a module.

That said, I'm not completely sure what you're trying to do, so I
don't know if that's what you're looking for.

-Eli



More information about the llvm-dev mailing list