9

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

sepp2k
  • 363,768
  • 54
  • 674
  • 675
dalibocai
  • 2,289
  • 5
  • 29
  • 45

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
  • 9,074
  • 25
  • 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