<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Aug 31, 2010, at 10:43 AM, Rafael Espindola wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div><blockquote type="cite">I am not sure why "before it is optimized?". May be this is gold specific ?<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">One of the use of this utility is a debugging aid. The linker can select to do this when -save-temps is used on the command line.<br></blockquote><br>I think an example will explain. Lets say we have a function foo that<br>is unused. The output of lto_codegen_write_merged_modules will have<br>foo in it, but it will be marked as an internal function. The .o<br>produced by libLTO will not have foo anymore.<font class="Apple-style-span" color="#000000"><font class="Apple-style-span" color="#006312"><br></font></font></div></blockquote><br></div><div>Would not it be useful to debug LLVM optimizer bugs ?</div><div><br></div><div>BTW, if you call lto_codegen_write_merged_modules() from linker after optimization but before generating machine code and you'll get a .bc file without function foo.</div><div><br></div><div>In other words, when to use this hook is up to libLTO user. It is not required to use this hook all the time. </div><div>-</div><div>Devang</div><br></body></html>