[llvm-dev] Is -disable-llvm-passes and -disable-llvm-optzns different?

toddy wang via llvm-dev llvm-dev at lists.llvm.org
Mon Jan 8 22:40:23 PST 2018


Hi guys,

According to this patch review:
*Title: Remove the '-disable-llvm-passes' flag (which I didn't even know
existed, and I suspect many others aren't aware of either) and strength
'-disable-llvm-optzns' to do the same thing*
Link: https://reviews.llvm.org/D28047

*-disable-llvm-optzns and -disable-llvm-passes are aliasing each other.*

*1. Both  can be passed to cc1 w/ -Xclang when compilation is run to
finish.*
E.g
[twang15 at c89 temp]$ clang++ -O2 -Xclang -disable-llvm-optzns -save-temps
LULESH.cc
[twang15 at c89 temp]$ cp a.out a.out.1
[twang15 at c89 temp]$ clang++ -O2 -Xclang -disable-llvm-passes -save-temps
LULESH.cc
[twang15 at c89 temp]$ diff a.out a.out.1
[twang15 at c89 temp]$

*2. Both cannot be passed w/ -mllvm without -emit-llvm -c*

[twang15 at c89 temp]$ clang++ -O2 -mllvm -disable-llvm-optzns -save-temps
 LULESH.cc
clang (LLVM option parsing): Unknown command line argument
'-disable-llvm-optzns'.  Try: 'clang (LLVM option parsing) -help'
clang (LLVM option parsing): Did you mean '-disable-cgp-gc-opts'?

[twang15 at c89 temp]$ clang++ -O2 -mllvm -disable-llvm-passes -save-temps
 LULESH.cc
clang (LLVM option parsing): Unknown command line argument
'-disable-llvm-passes'.  Try: 'clang (LLVM option parsing) -help'
clang (LLVM option parsing): Did you mean '-disable-cleanups'?

*3. However, -disable-llvm-optzns can be passed w/ -mllvm when -emit-llvm
is also passed, but -disable-llvm-passes cannot *

[twang15 at c89 temp]$ clang++ -O2 -mllvm -disable-llvm-optzns -save-temps
-emit-llvm -c LULESH.cc

[twang15 at c89 temp]$ clang++ -O2 -mllvm -disable-llvm-passes -save-temps
-emit-llvm -c LULESH.cc
clang (LLVM option parsing): Unknown command line argument
'-disable-llvm-passes'.  Try: 'clang (LLVM option parsing) -help'
clang (LLVM option parsing): Did you mean '-disable-cleanups'?

*My questions: *
1. Is there a bug?

2. Lastly, try as clang instructs me: Try: 'clang (LLVM option parsing)
-help'

[twang15 at c89 temp]$ clang (LLVM option parsing) -help
-bash: syntax error near unexpected token `LLVM'

Can clang give me more helpful information on which flags can be passed
with mllvm and which can be passed with -Xclang?

3. It seems to me clang cc1 has at least two major stages to handle *bc
file.
The first stage is to transform c/c++ to bc without any or w/ little
optimizations, and -disable-llvm-passes is enabled by default.

The second stage is to optimize bc files and output .s assembly. And by
default, -disable-llvm-passes is disabled for this stage. -Xclang
-disable-llvm-passes or -Xclang disable-llvm-optzns will affect this stage.

Is this a correct understanding? or Partially correct? Where -mllvm options
come into play?

Thanks a lot!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180109/a212f6c0/attachment.html>


More information about the llvm-dev mailing list