-O0: -targetlibinfo -preverify -domtree -verify
-O1 is based on -O0
adds: -adce -always-inline -basicaa -basiccg -correlated-propagation -deadargelim -dse -early-cse -functionattrs -globalopt -indvars -inline-cost -instcombine -ipsccp -jump-threading -lazy-value-info -lcssa -licm -loop-deletion -loop-idiom -loop-rotate -loop-simplify -loop-unroll -loop-unswitch -loops -lower-expect -memcpyopt -memdep -no-aa -notti -prune-eh -reassociate -scalar-evolution -sccp -simplifycfg -sroa -strip-dead-prototypes -tailcallelim -tbaa
-O2 is based on -01
adds: -barrier -constmerge -domtree -globaldce -gvn -inline -loop-vectorize -preverify -slp-vectorizer -targetlibinfo -verify
removes: -always-inline
-O3 is based on -O2
adds: -argpromotion
-Os is identical to -O2
-Oz is based on -O2
removes: -barrier -loop-vectorize -slp-vectorizer
-O/-O0:: 不做优化,默认选项
-O1:最基本的优化等级,主要涉及常量合并,条件分支和表达式