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

Christophe de Dinechin christophe at taodyne.com
Thu Jan 6 10:36:05 PST 2011


On 6 janv. 2011, at 19:00, llvmdev-request at cs.uiuc.edu wrote:

>> 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?

Because I have pointers to functions which suddenly go bad.

>> 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.

Thanks for explaining.

Why not redefine it from historical anachronism to architectural flag, that indicates you may generate more code with the same functions and globals later? And then, you could pass the same flag to createStandardLTOPasses, and that would skip the GlobalDCE passes.


>> 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.

They are not used this time. But why can't I generate additional code in the same module after having run LTO?



More information about the llvm-dev mailing list