Hi Duncan, Thanks for your help. But seems "opt -std-compile-opts" can't do this simplication :( Any ideas? Sheng. 2008/9/4 Duncan Sands <baldrick at free.fr>> > I tried several passes, like -instcombine, -simplifycfg, -gcse -globaldce > > -globalopt -adce , but all failed to do this transform. > > Try "opt -std-compile-opts -debug-pass=Arguments" > If that does the simplification, then try bisecting > the set of passes it ran (printed thanks to -debug-pass) > to find out which combination did it. > > Ciao, > > Duncan. >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20080905/24bb3f6b/attachment.html>
> Any ideas?Most likely it is the gcc folder doing it. This gcc optimization is run in llvm-gcc because it's basically impossible to turn it off! You can check by passing -mllvm -disable-llvm-optzns to llvm-gcc along with -O2. If the optimization still occurs then it was gcc that did it. Ciao, Duncan.
2008/9/5 Duncan Sands <baldrick at free.fr>> > Any ideas? > > Most likely it is the gcc folder doing it. > This gcc optimization is run in llvm-gcc > because it's basically impossible to turn > it off!Agree. I found that gcc option -fstrict-overflow, with which gcc will do that simplication. Defaultly, that option is turn on with -O2 or above.> You can check by passing > -mllvm -disable-llvm-optzns > to llvm-gcc along with -O2. If the > optimization still occurs then it was > gcc that did it.eh... I got some error as following: llvm-gcc -O2 -mllvm -disable-llvm-optzns -emit-llvm -c test.c -o test.ll -S cc1: warning: unrecognized gcc debugging option: i cc1: warning: unrecognized gcc debugging option: s cc1: warning: unrecognized gcc debugging option: b cc1: warning: unrecognized gcc debugging option: l cc1: warning: unrecognized gcc debugging option: e cc1: warning: unrecognized gcc debugging option: - cc1: warning: unrecognized gcc debugging option: l cc1: warning: unrecognized gcc debugging option: l cc1: warning: unrecognized gcc debugging option: m cc1: warning: unrecognized gcc debugging option: - cc1: warning: unrecognized gcc debugging option: o cc1: warning: unrecognized gcc debugging option: t cc1: warning: unrecognized gcc debugging option: z cc1: warning: unrecognized gcc debugging option: n cc1: warning: unrecognized gcc debugging option: s cc1: Unknown command line argument '-mtune=generic'. Try: 'cc1 --help' Am I missing something? Sheng.> > > Ciao, > > Duncan. >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20080906/52b83751/attachment.html>