0

I've got a LLVM Module and I was wondering if there was an easy way to run all LLVM optimizations passes using the C++ API for -O3 (without having to register each pass individually).

agg212
  • 407
  • 1
  • 4
  • 17

1 Answers1

3

Yes, you need to use the PassManagerBuilder class for it. You set the optimization level, and then ask it to populate a pass manager for you.

An easy way to see how it's done is to look at the source of opt.cpp in the LLVM repository - right here.

Eli Bendersky
  • 263,248
  • 89
  • 350
  • 412