LTO API: lto_codegen_optimize and lto_codegen_compile_optimized

Manman Ren mren at
Fri Jan 30 12:01:55 PST 2015

We currently have lto_codegen_compile that runs IR passes and codegen passes. If we dump the bitcode file after lto_codegen_compile, codegen passes can modify IR (one example is StackProtector pass).
If we run “llc lto.opt.bc”, we will get assertion failure because llc runs StackProtector pass again.

To enable dumping bitcode file right before running the codegen passes, this patch splits lto_codegen_compile in 2

Linker can choose to dump the bitcode file before calling lto_codegen_compile_optimize and we can debug the codegen passes from the dumped bitcode file.

I initially had a different proposal, thanks to Rafael for suggesting this solution!


-------------- next part --------------
A non-text attachment was scrubbed...
Name: lto.patch
Type: application/octet-stream
Size: 9621 bytes
Desc: not available
URL: <>

More information about the llvm-commits mailing list