1

I'm looking for a way to activate optimization flag independently like in GCC, because looking from GCC docs we can see what optimizations -Ox flag consist of.

I saw a post on how to parse optimizations used by clang for -Ox here.

But those optimization flags is not there if i run clang++ --help. because the flags are for opt.

Is there a way for me to do that? The clang that i'm using comes from NDK r16b.

EDIT: I'm sorry for the confusion caused by my question. I'm adding an example of what I want to do in clang that can be done easily in GCC.

On GCC I can write:

g++ -fauto-inc-dec -fbranch-count-reg -fcombine-stack-adjustments -fcompare-elim -fcprop-registers -fdce -fdefer-pop -fdelayed-branch -fdse -fforward-propagate -fguess-branch-probability -fif-conversion2 -fif-conversion -finline-functions-called-once -fipa-pure-const -fipa-profile -fipa-reference -fmerge-constants -fmove-loop-invariants -fomit-frame-pointer -freorder-blocks -fshrink-wrap -fshrink-wrap-separate -fsplit-wide-types -fssa-backprop -fssa-phiopt -ftree-bit-ccp -ftree-ccp -ftree-ch -ftree-coalesce-vars -ftree-copy-prop -ftree-dce -ftree-dominator-opts -ftree-dse -ftree-forwprop -ftree-fre -ftree-phiprop -ftree-sink -ftree-slsr -ftree-sra -ftree-pta -ftree-ter -funit-at-a-time

or

g++ -O1

which should be the same according to the doc. can I do that with clang?

  • 1
    Are you asking how to add individual flags to a `clang` compile command? Or how to find what flags are available? Or something else? – Mats Petersson Feb 04 '18 at 16:24
  • `clang --help-hidden` will show some more stuff than `clang --help`, but I don't think it really lists optimisation information. – Mats Petersson Feb 04 '18 at 16:26
  • @MatsPetersson I want to add individual flags to clang. –  Feb 04 '18 at 16:37
  • So do that? There's nothing different here for Clang. – Dan Albert May 14 '18 at 21:14
  • @DanAlbert "do that?" stands for do what? clang has no man page, no info node, and clang --help says literally nothing about what -O1, -O2, -O3 and other -O? stand for. – Vladimir Nikishkin Jul 13 '19 at 05:56
  • You said you wanted to pass flags to Clang. You do that by passing flags to Clang. If you're trying to figure out what optimizations are used at each optimization level, that's what you should have asked. If that is what you're asking (I'm still not sure), see https://stackoverflow.com/a/15548189/632035 – Dan Albert Jul 15 '19 at 21:13

0 Answers0