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.)

Community
  • 1
  • 1
John Smith
  • 173
  • 1
  • 1
  • 6
  • 2
    Can't you just use `-O1`? Also, AFAIK, some optimizations are built in the compiler and can't be disabled. – edmz Jan 25 '16 at 13:14
  • I don't think you can. Easiest option is using -O1 and then adding the flags you actually need, AFAIK. – Andrej Jan 25 '16 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` – John Smith Jan 25 '16 at 14:05

0 Answers0