Relationship between clang, opt and llc

Thanks, Craig.

So, clang -Xclang -disable-llvm-passes actually disables all the LLVM passed populated by clang so that there is no middle-end optimization on bc files.

clang -O2 LULESH.c //clang is the driver, invoking cc1, cc1as, ld
//options can be passed through to cc1 directly.
//maybe have different names, e.g. -fvectorize in clang driver and -vectorize-loops in clang -cc1
//options are dumped by clang -help and clang --help-hidden

clang -cc1 // c/c++ frontend is also referred as clang
// this is the c/c++ frontend(preprocessor + Lexer + parser) and middle-end ( LLVM-IR optimizer + IR-assembly generator)
//controlled by -Xclang , Xclang options dumped by clang -cc1 -help
//mllvm Options like -unroll-max count are controlled by -mllvm .
//mllvm Options can be dumped by clang -v -help -mllvm and clang -v --help-hidden

//Question: are all mllvm options for middle-end while Xclang options are for front-end?

clang -cc1as // assembly-obj assembler
ld/ldd/gold //linker (if -flto is not provided) or link-time optimizer and linker (if -flto -fuse-ld=lld is provided or -flto -fuse-ld=gold is provided)

//mllvm Options can be dumped by clang -v -help -mllvm and clang -v --help-hidden

//mllvm Options can be dumped by clang -v -help -mllvm and clang -v --help-hidden -mllvm

Sorry,

//mllvm Options can be dumped by clang -v -help -mllvm and clang -v --help-hidden -mllvm

→ should be

//mllvm Options can be dumped by opt -help-hidden

mllvm options are LLVM *developer* options, which includes the middle-end
and the backend.
Xclang options are intended to bypass the driver and pass directly CC1
options. These can also control the middle-end, for example the
-vectorize-loops you mentioned above.