[PATCH] Added -mlink-init-bitcode-file option to pre-populate new module with IR loaded from specified file.

Peter Collingbourne peter at pcc.me.uk
Mon Jun 8 15:23:32 PDT 2015

I was the person who originally introduced this flag in r143314. As I recall this flag was introduced in order to support linking a bitcode module containing an implementation of a runtime library for a GPU (e.g. libclc).

The reason I made the flag link the bitcode after compilation was that I wanted to avoid breaking any invariants that Clang's code generator might have (e.g. if both the bitcode file and the C source file define a weak symbol, Clang's IR generator may get confused by the presence of a duplicate symbol, whereas the IR linker already knows to discard one of them). If avoiding the IR linker provides a significant performance advantage, it does seem reasonable to make `-mlink-bitcode-file` pre-populate the module, and start fixing any assumptions we're currently making in the IR generator.



More information about the cfe-commits mailing list