get llvm IR after a clang optimization pass.

Hi,

I’d like to run clang with some optimization passes (-reassociate, -simplifycfg, -dce…)

But in the end I need to dump the llvm IR (no link to assembly generation).

I didn’t find any way to do that.

I found out that passes are run via opt, but opt generates bc code, and I want IR.

Any help will be welcome

Thanks,

Régis

Hi Régis,

with clang, you can use add `-emit-llvm -S` to get it to output IR
directly. With opt just add -S to get IR instead of bitcode.

Björn

HI Björn

Thanks,

Works perfectly well!