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

HwJ via llvm-dev llvm-dev at lists.llvm.org
Fri Mar 16 07:04:42 PDT 2018


Works. Thanks a lot!

On Fri, Mar 16, 2018 at 02:30:32PM +0100, Son Tuan VU 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>
>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
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>>


More information about the llvm-dev mailing list