How can I find the flag dependency or conflict in LLVM?

Viewed 133

As I know, GCC has this website to figure out the relationship between different flags using while optimization. GCC example website. Like fpartialInlining can only be useful when findirectInlining is turned on.

I think the same thing would happen in clang, in other words, I think the different passes may have this kind of dependcy/confilcts relationship in LLVM(CLANG).

But after checking all the document provided by developers, I find it just say something about the functionality in these passes. LLVM PASS DOC

So my question can be divided into 2 parts I think:

  1. Does the dependency exists in LLVM PASS or there is no such dependency/conflicts
  2. If there is, how can I find them.
1 Answers

You can find which passes are using in which optimization levels by clang while compiling any c or c++ code with clang and try to figure out dependencies. For example:

clang -O2 --target=riscv32 -mllvm -debug-pass=Structure example.c

(You can use also -debug-pass=Arguments instead of -debug-pass=Structure. It depends readability.)

this will give which passes used by clang at 2. optimization level for riscv32 target. If you don't give a target it sets default as your host machine target, and keep in mind that some used passes changes related to different targets at same optimization levels.

Related