[LLVMdev] Marking a function prototype as being "persistent"

Duncan Sands baldrick at free.fr
Thu Jan 6 09:06:39 PST 2011


Hi Christophe,

> I'm using LLVM to JIT-compile the XL programming language. I've recently added a whole-program optimization phase that gives excellent results, but I noticed that the StripDeadPrototypesPass was removing all references to my runtime support functions.

why is that a problem?

> Apparently, this depends on the oddly-named UnitAtATime parameter. Set it to false. Try again. Suggestion: what about a comment explaining what "UnitAtATime" means :-)

If UnitAtATime is false this means that you are optimizing functions as you are
generating them, rather than first generating all functions and other globals
and only then optimizing.  It's basically a historical anachronism coming from
the way GCC used to work.

> Even then, my runtime function prorotypes are still being stripped away by the GlobalDCE added by createStandardLTOPasses.

Sure, and why not?  Unused prototypes are not used for anything, they won't
turn up in the generated code for example.

> So my question is: what is the correct, officially recommended way to reference runtime functions so that global DCE won't get rid of them? Or am I supposed to re-create the corresponding Function instances for every translation?

There's some kind of disconnect here, so you need to explain more :)

Ciao, Duncan.



More information about the llvm-dev mailing list