HwJ via llvm-dev
2018-Mar-16 13:15 UTC
[llvm-dev] opt: how to invoke optimizations manually?
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; > }
Son Tuan VU via llvm-dev
2018-Mar-16 13:30 UTC
[llvm-dev] opt: how to invoke optimizations manually?
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>
HwJ via llvm-dev
2018-Mar-16 14:04 UTC
[llvm-dev] opt: how to invoke optimizations manually?
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 >>
John Regehr via llvm-dev
2018-Mar-16 18:31 UTC
[llvm-dev] opt: how to invoke optimizations manually?
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 >