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

Son Tuan VU via llvm-dev llvm-dev at lists.llvm.org
Fri Mar 16 06:30:32 PDT 2018


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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180316/960edcea/attachment.html>


More information about the llvm-dev mailing list