[llvm-dev] opt: how to invoke optimizations manually?

HwJ via llvm-dev llvm-dev at lists.llvm.org
Thu Apr 19 04:47:57 PDT 2018


one more guy fell into "optnone":
	https://lists.llvm.org/pipermail/llvm-dev/2018-April/122602.html

On Fri, Mar 16, 2018 at 12:31:23PM -0600, John Regehr via llvm-dev wrote:
>I feel like it might save people some significant time in the long run 
>if opt printed a helpful little error message when it is instructed to 
>run >0 transformation passes and also all functions it sees are 
>optnone.
>
>John
>
>
>
>On 3/16/18 7:30 AM, Son Tuan VU via llvm-dev wrote:
>>Hi,
>>
>>You should add this option to the first command 
>>*"-disable-O0-optnone"* so *clang -Xclang -disable-O0-optnone 
>>-emit-llvm -S -o without_dce.ll test.c* then *opt -dce -S < 
>>without_dce.ll > with_dce.ll*
>>*
>>*
>>HTH,
>>
>>Son Tuan Vu
>>
>>On Fri, Mar 16, 2018 at 2:15 PM, HwJ via llvm-dev 
>><llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org>> wrote:
>>
>>    Hello,
>>
>>    I'd like to measure the impact of optimizations.
>>    Trying this (for DCE):
>>
>>    * clang -S -emit-llvm test.c
>>    * opt -S test.ll > without_dce.ll
>>    * opt -S -dce test.ll > with_dce.ll
>>
>>    gives without_dce.ll and with_dce.ll having the same content.
>>
>>    How can you apply certain optimizations in a specified order?
>>
>>    Best,
>>    HwJ
>>
>>    ---
>>
>>    $ cat test.c
>>
>>        int dce(int n) {
>>             if ((n < 0) || (n >= 0))
>>                 return 1;
>>
>>             return 0;
>>        }
>>
>>    _______________________________________________
>>    LLVM Developers mailing list
>>    llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org>
>>    http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>>    <http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev>
>>
>>
>>
>>
>>_______________________________________________
>>LLVM Developers mailing list
>>llvm-dev at lists.llvm.org
>>http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>>
>_______________________________________________
>LLVM Developers mailing list
>llvm-dev at lists.llvm.org
>http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev


More information about the llvm-dev mailing list