Emit LLVM bitcode after ThinLTO

Hi,

I wanted to get the linked result in LLVM bitcode format.

With LTO, this can be done by -flto -Wl,-plugin-opt,emit-llvm. Instead of generating native executables, it outputs a file with bitcode format.

Does this still work with -flto=thin? -flto=thin -Wl,-plugin-opt,emit-llvm outputs a bitcode file, but its file size is too small, and does not contain all contents.

What is the correct way to emit LLVM bitcode after ThinLTO?

Thank you, S

I think there is a way, but I'm not entirely sure.

It's possible you've got the right thing & it's just that ThinLTO's
optimized away most of the file you're looking at?

Looks like I forgot to reply all so my reply and our follow on conversation got lost. Copied it below. Basically, this is expected because -emit-llvm only emits the result of the regular LTO link, which is typically empty for a normal ThinLTO build.

Teresa