[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 23:34:43 PST 2018
Thanks for pointing this out.
The following is a more extensive test.
//succeed means dumping help info without Error message.
clang -help #succeed
'clang -help-hidden' #Fail
'clang --help-hidden' #Succeed
clang -mllvm -v -help #Succeed
clang -mllvm -v -help-hidden #Fail
clang -mllvm -v --help-hidden #Succeed
'clang -mllvm -help -c LULESH.cc' #Succeed
'clang -mllvm -help LULESH.cc' # Fail
clang -cc1 -help #Succeed
clang -cc1 -help-hidden #Fail . (may be no hidden option)
clang -cc1 --help-hidden #Fail
opt -help #Succeed
opt --help #Succeed
opt -help-hidden #Succeed
opt --help-hidden #Succeed
llc -help #Succeed
llc --help #Succeed
llc -help-hidden #Succeed
llc --help-hidden #Succeed
lld -help #Succeed
lld --help #Succeed
lld -help-hidden #Fail (may be no hidden option)
lld --help-hidden # Fail
On Tue, Jan 9, 2018 at 2:07 AM, toddy wang <wenwangtoddy at gmail.com> wrote:
> clang -O3 -mllvm -help -c LULESH.cc succeeds.
>
> On Tue, Jan 9, 2018 at 2:05 AM, toddy wang <wenwangtoddy at gmail.com> wrote:
>
>> 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/4857b438/attachment.html>
More information about the llvm-dev
mailing list