2010/10/27 Rafael Espíndola <rafael.espindola at gmail.com>> 2010/10/27 Xinliang David Li <xinliangli at gmail.com>: > > Thanks. Just built clang and saw the meta data and annotations on the > memory > > accesses -- is any opt pass consuming the information? > > The tests in test/Analysis/TypeBasedAliasAnalysis suggest that at > least licm is using it. Also note that > lib/Analysis/TypeBasedAliasAnalysis.cpp defines as enable-tbaa option > that is off by default. > >I tried the option -- no much differences in the generated code. A related question: how to pass the llvm specific options from clang driver? It supports -Wl, -Wa, -Xanalyzer etc, but there is no documentation on how to pass -enable-tbaa to opt driver. llvmc supports -Wo, option, but the option specified after -Wo, seems to be dropped. Another thing, when using -clang option to llvmc, I got link errors even when -c or -S is specified: clang -x c foo.c -emit-llvm-bc -o /tmp/llvm_JnS1o8/foo.bc (.text+0x20): undefined reference to `main' collect2: ld returned 1 exit status clang: error: linker (via gcc) command failed with exit code 1 (use -v to see invocation) David> > By the way the build instruction in this > > page http://clang.llvm.org/get_started.html needs to be updated -- it > > recommends config (with default settings) and build llvm in the source > dir > > -- it leaves some 'sticky' generated files in the source dir leading to > > building problems. > > Thanks. Will try to improve it a bit. > > > > > David > > 2010/10/27 Rafael Espíndola <rafael.espindola at gmail.com> > > Cheers, > Rafael >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20101028/031ea638/attachment.html>
On Oct 28, 2010, at 2:43 PM, Xinliang David Li wrote:> > > 2010/10/27 Rafael Espíndola <rafael.espindola at gmail.com> > 2010/10/27 Xinliang David Li <xinliangli at gmail.com>: > > Thanks. Just built clang and saw the meta data and annotations on the memory > > accesses -- is any opt pass consuming the information? > > The tests in test/Analysis/TypeBasedAliasAnalysis suggest that at > least licm is using it. Also note that > lib/Analysis/TypeBasedAliasAnalysis.cpp defines as enable-tbaa option > that is off by default.LICM, GVN, and DSE are the major consumers right now. That said, the current TBAA implementation is not very advanced yet.> I tried the option -- no much differences in the generated code.Can you give an example of code you'd expect to be optimized which isn't? Dan
As simple as void foo (int n, double *p, int *q) { for (int i = 0; i < n; i++) *p += *q; } clang -O2 -fstrict-aliasing -emit-llvm -o foo.bc -c foo.c llc -enable-tbaa -O2 -filetype=asm -o foo.s foo.bc Memory accesses remain in the loop. The following works fine: void foo(int n, double *restrict p, int * restrict *q) { ... } By the way, Is there a performance category in the llvm bug database? Thanks, David On Thu, Oct 28, 2010 at 5:59 PM, Dan Gohman <gohman at apple.com> wrote:> > On Oct 28, 2010, at 2:43 PM, Xinliang David Li wrote: > > > > > > > 2010/10/27 Rafael Espíndola <rafael.espindola at gmail.com> > > 2010/10/27 Xinliang David Li <xinliangli at gmail.com>: > > > Thanks. Just built clang and saw the meta data and annotations on the > memory > > > accesses -- is any opt pass consuming the information? > > > > The tests in test/Analysis/TypeBasedAliasAnalysis suggest that at > > least licm is using it. Also note that > > lib/Analysis/TypeBasedAliasAnalysis.cpp defines as enable-tbaa option > > that is off by default. > > LICM, GVN, and DSE are the major consumers right now. That said, the > current TBAA implementation is not very advanced yet. > > > I tried the option -- no much differences in the generated code. > > Can you give an example of code you'd expect to be optimized which isn't? > > Dan > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20101028/d688e25b/attachment.html>
> clang -x c foo.c -emit-llvm-bc -o /tmp/llvm_JnS1o8/foo.bc > (.text+0x20): undefined reference to `main' > collect2: ld returned 1 exit status > clang: error: linker (via gcc) command failed with exit code 1 (use -v to > see invocation)Without a -c I think clang is trying to link the llvm IL file. For that to work you would need a linker that understands LLVM IL. Both the apple linker and gold support plugins for doing it.> DavidCheers, Rafael
2010/10/29 Rafael Espíndola <rafael.espindola at gmail.com>> > clang -x c foo.c -emit-llvm-bc -o /tmp/llvm_JnS1o8/foo.bc > > (.text+0x20): undefined reference to `main' > > collect2: ld returned 1 exit status > > clang: error: linker (via gcc) command failed with exit code 1 (use -v to > > see invocation) > > Without a -c I think clang is trying to link the llvm IL file. For > that to work you would need a linker that understands LLVM IL. Both > the apple linker and gold support plugins for doing it. >Then it looks like a bug in llvmc driver -- -c is not passed to clang. David> > > David > > Cheers, > Rafael >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20101029/58f1a133/attachment.html>