<div dir="ltr">Hi,<div><br></div><div>You should add this option to the first command <b>"-disable-O0-optnone"</b> so <b>clang -Xclang -disable-O0-optnone -emit-llvm -S -o without_dce.ll test.c</b> then <b>opt -dce -S < without_dce.ll > with_dce.ll</b></div><div><b><br></b></div><div>HTH,</div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">Son Tuan Vu</div></div></div>
<br><div class="gmail_quote">On Fri, Mar 16, 2018 at 2:15 PM, HwJ via llvm-dev <span dir="ltr"><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello,<br>
<br>
I'd like to measure the impact of optimizations.<br>
Trying this (for DCE):<br>
<br>
* clang -S -emit-llvm test.c<br>
* opt -S test.ll > without_dce.ll<br>
* opt -S -dce test.ll > with_dce.ll<br>
<br>
gives without_dce.ll and with_dce.ll having the same content.<br>
<br>
How can you apply certain optimizations in a specified order?<br>
<br>
Best,<br>
HwJ<br>
<br>
---<br>
<br>
$ cat test.c<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
int dce(int n) {<br>
    if ((n < 0) || (n >= 0))<br>
        return 1;<br>
<br>
    return 0;<br>
}<br>
</blockquote>
______________________________<wbr>_________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-dev</a><br>
</blockquote></div><br></div>