toddy wang via llvm-dev
2018-Jan-09 06:40 UTC
[llvm-dev] Is -disable-llvm-passes and -disable-llvm-optzns different?
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>
Craig Topper via llvm-dev
2018-Jan-09 06:56 UTC
[llvm-dev] Is -disable-llvm-passes and -disable-llvm-optzns different?
There's a hack in lib/Driver/ToolChains/Clang.cpp to accept "-mllvm -disable-llvm-optzns" as a hack for legacy compatibility. It's deprecated and the -Xclang spelling should be used. There does appear to be a bug with "-mllvm -disable-llvm-optzns" and -save-temps. -save-temps causes clang to be invoked separately to text assembly into binary code, and it looks like that call to clang gets -mllvm -disable-llvm-optzns passed to it but it isn't capable of handling it. You can see this if you add "-v" to your command line so you can see all the subprocesses that get invoked. For the -help question, when clang printed "Try: 'clang (LLVM option parsing) -help'" it was trying and failing to tell you to type "clang -mllvm -help" or "clang -mllvm -help-hidden". This will print the help from the llvm components. ~Craig On Mon, Jan 8, 2018 at 10:40 PM, toddy wang via llvm-dev < llvm-dev at lists.llvm.org> wrote:> 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! > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180108/a1004359/attachment.html>
toddy wang via llvm-dev
2018-Jan-09 07:05 UTC
[llvm-dev] Is -disable-llvm-passes and -disable-llvm-optzns different?
Quick results: [twang15 at c89 temp]$ clang -mllvm -help clang-5.0: error: no input files [twang15 at c89 temp]$ clang -mllvm -help-hidden clang-5.0: error: no input files [twang15 at c89 temp]$ clang -mllvm --help-hidden clang-5.0: error: no input files [twang15 at c89 temp]$ clang -mllvm --help clang-5.0: error: no input files Anything wrong? On Tue, Jan 9, 2018 at 1:56 AM, Craig Topper <craig.topper at gmail.com> wrote:> There's a hack in lib/Driver/ToolChains/Clang.cpp to accept "-mllvm > -disable-llvm-optzns" as a hack for legacy compatibility. It's deprecated > and the -Xclang spelling should be used. > > There does appear to be a bug with "-mllvm -disable-llvm-optzns" and > -save-temps. -save-temps causes clang to be invoked separately to text > assembly into binary code, and it looks like that call to clang gets -mllvm > -disable-llvm-optzns passed to it but it isn't capable of handling it. You > can see this if you add "-v" to your command line so you can see all the > subprocesses that get invoked. > > For the -help question, when clang printed "Try: 'clang (LLVM option > parsing) -help'" it was trying and failing to tell you to type "clang > -mllvm -help" or "clang -mllvm -help-hidden". This will print the help from > the llvm components. > > ~Craig > > On Mon, Jan 8, 2018 at 10:40 PM, toddy wang via llvm-dev < > llvm-dev at lists.llvm.org> wrote: > >> 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! >> >> _______________________________________________ >> LLVM Developers mailing list >> llvm-dev at lists.llvm.org >> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >> >> >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180109/0904aa8b/attachment-0001.html>
Apparently Analagous Threads
- Is -disable-llvm-passes and -disable-llvm-optzns different?
- Is -disable-llvm-passes and -disable-llvm-optzns different?
- Is -disable-llvm-passes and -disable-llvm-optzns different?
- Is -disable-llvm-passes and -disable-llvm-optzns different?
- Relationship between clang, opt and llc