9

Where can I find the sequence of optimizations used by clang according to -OX?

sepp2k
  • 353,842
  • 52
  • 662
  • 667
dalibocai
  • 2,189
  • 5
  • 28
  • 43

1 Answers1

17

clang executes the precisely same sequence of passes as opt -ON. So, you can do something like

llvm-as < /dev/null | opt -O3 -disable-output -debug-pass=Arguments 

to derive the "full" set of passes which are run at O3.

Anton Korobeynikov
  • 8,603
  • 23
  • 28
  • 1
    But I only see up to O3 in opt. Why clang has O4? – dalibocai Oct 18 '11 at 13:47
  • 1
    -O4 usually means link-time optimization, thus it cannot be performed via opt alone. The set of passes suitable for LTO can be found via opt -std-link-opts. – Anton Korobeynikov Oct 18 '11 at 17:07
  • Thanks! I parsed and posted the output for all optimization levels [here](http://stackoverflow.com/a/15548189/762488) for llvm 3.2 – Antoine Mar 21 '13 at 13:26