<div dir="ltr"><div>Hi guys,</div><div><br></div><div>According to this patch review:</div><div><i>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 <b>do the same thing</b></i></div><div>Link: <a href="https://reviews.llvm.org/D28047">https://reviews.llvm.org/D28047</a></div><div><br></div><div><b>-disable-llvm-optzns and -disable-llvm-passes are aliasing each other.</b><br></div><div><b><br></b></div><div><b>1. Both  can be passed to cc1 w/ -Xclang when compilation is run to finish.</b></div><div>E.g</div><div><div>[twang15@c89 temp]$ clang++ -O2 -Xclang -disable-llvm-optzns -save-temps LULESH.cc </div><div>[twang15@c89 temp]$ cp a.out a.out.1</div><div>[twang15@c89 temp]$ clang++ -O2 -Xclang -disable-llvm-passes -save-temps LULESH.cc <br></div><div>[twang15@c89 temp]$ diff a.out a.out.1</div><div>[twang15@c89 temp]$ </div></div><div><br></div><div><div><b>2. Both cannot be passed w/ -mllvm without -emit-llvm -c</b></div><div><br></div><div><div>[twang15@c89 temp]$ clang++ -O2 -mllvm -disable-llvm-optzns -save-temps  LULESH.cc </div><div>clang (LLVM option parsing): Unknown command line argument '-disable-llvm-optzns'.  Try: 'clang (LLVM option parsing) -help'</div><div>clang (LLVM option parsing): Did you mean '-disable-cgp-gc-opts'?</div></div><div><br></div><div><div>[twang15@c89 temp]$ clang++ -O2 -mllvm -disable-llvm-passes -save-temps  LULESH.cc </div><div>clang (LLVM option parsing): Unknown command line argument '-disable-llvm-passes'.  Try: 'clang (LLVM option parsing) -help'</div><div>clang (LLVM option parsing): Did you mean '-disable-cleanups'?</div></div></div><div><br></div><div><b>3. However, -disable-llvm-optzns can be passed w/ -mllvm when -emit-llvm is also passed, but -disable-llvm-passes cannot </b></div><div><div><br></div><div>[twang15@c89 temp]$ clang++ -O2 -mllvm -disable-llvm-optzns -save-temps -emit-llvm -c LULESH.cc <br></div></div><div><div><br></div><div>[twang15@c89 temp]$ clang++ -O2 -mllvm -disable-llvm-passes -save-temps -emit-llvm -c LULESH.cc </div><div>clang (LLVM option parsing): Unknown command line argument '-disable-llvm-passes'.  Try: 'clang (LLVM option parsing) -help'</div><div>clang (LLVM option parsing): Did you mean '-disable-cleanups'?</div></div><div><br></div><div><b>My questions: </b></div><div>1. Is there a bug?<br></div><div><br></div><div>2. Lastly, try as clang instructs me: Try: 'clang (LLVM option parsing) -help'</div><div><br></div><div><div>[twang15@c89 temp]$ clang (LLVM option parsing) -help</div><div>-bash: syntax error near unexpected token `LLVM'</div></div><div><br></div><div>Can clang give me more helpful information on which flags can be passed with mllvm and which can be passed with -Xclang?</div><div><br></div><div>3. It seems to me clang cc1 has at least two major stages to handle *bc file.</div><div>The first stage is to transform c/c++ to bc without any or w/ little optimizations, and -disable-llvm-passes is enabled by default.</div><div><br></div><div>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.</div><div><br></div><div>Is this a correct understanding? or Partially correct? Where -mllvm options come into play?</div><div><br></div><div>Thanks a lot!</div></div>