[llvm-dev] Determine reason for failure at -O1

Jeffrey Walton via llvm-dev llvm-dev at lists.llvm.org
Sat Jun 30 16:56:43 PDT 2018

On Sat, Jun 30, 2018 at 2:37 PM, David Blaikie <dblaikie at gmail.com> wrote:
> I'd suggest approach this like any other bug in source code (not in the
> compiler) - reduce the example, isolate the failure - until you either find
> a source bug, or a small, standalone example that seems to demonstrate a
> contradiction or bug in the way the compiler is interpreting the source.

Thanks Davis.

According to https://stackoverflow.com/q/15548023/608639 the list of
optimizations applied at -O1 include:

-globalopt -demanded-bits -branch-prob -inferattrs -ipsccp -dse
-loop-simplify -scoped-noalias -barrier -adce -deadargelim -memdep
-licm -globals-aa -rpo-functionattrs -basiccg -loop-idiom -forceattrs
-mem2reg -simplifycfg -early-cse -instcombine -sccp -loop-unswitch
-loop-vectorize -tailcallelim -functionattrs -loop-accesses -memcpyopt
-loop-deletion -reassociate -strip-dead-prototypes -loops -basicaa
-correlated-propagation -lcssa -domtree -always-inline -aa -block-freq
-float2int -lower-expect -sroa -loop-unroll
-alignment-from-assumptions -lazy-value-info -prune-eh -jump-threading
-loop-rotate -indvars -bdce -scalar-evolution -tbaa

I tried backing off some of the optimizations to begin to isolate:

$ CXX=clang++ CXXFLAGS="-g2 -O1 -no-loop-vectorize" make cham-simd.o
clang++ -g2 -O1 -no-loop-vectorize -fPIC -pthread -pipe -c cham-simd.cpp
clang-6.0: error: unknown argument: '-no-loop-vectorize'
make: *** [GNUmakefile:1069: cham-simd.o] Error 1

So I guess my question is, how do I disable a particular optimization?


More information about the llvm-dev mailing list