4

I would like to individually disable the command line options which -O2 adds over -O1 in Clang (with the LLVM backend)

I was able to identify which flags -O2 enables over -O1 using on this post: Clang optimization levels

Flags -O2 adds: -inline -mldst-motion -gvn -globaldce -constmerge -slp-vectorizer -elim-avail-extern

How do I disable those flags individually?

(-disable-slp-vectorized worked but what about flags like -gvn -globaldce? I haven't been able to find a way to disable them.)

3
  • 2
    Can't you just use -O1? Also, AFAIK, some optimizations are built in the compiler and can't be disabled. Commented Jan 25, 2016 at 13:14
  • I don't think you can. Easiest option is using -O1 and then adding the flags you actually need, AFAIK. Commented Jan 25, 2016 at 13:22
  • I tried the other way around as well, but I don't have the confidence that they were actually enabled. I tried doing that using -mllvm -pass-remarks=gvn Commented Jan 25, 2016 at 14:05

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.