public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "vincenzo.innocente at cern dot ch" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/50698] New: pretending to create versioning for alias when not required Date: Wed, 12 Oct 2011 08:08:00 -0000 [thread overview] Message-ID: <bug-50698-4@http.gcc.gnu.org/bugzilla/> (raw) http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50698 Bug #: 50698 Summary: pretending to create versioning for alias when not required Classification: Unclassified Product: gcc Version: 4.7.0 Status: UNCONFIRMED Severity: minor Priority: P3 Component: tree-optimization AssignedTo: unassigned@gcc.gnu.org ReportedBy: vincenzo.innocente@cern.ch in the example below the vectorizer reports "versioning for alias" for function sumS (not for sum2). The compiler has all information to determine that no aliasing can happen and indeed the generated code eventually does not contain any run time check! One consequence is that in some similar real-life cases I'm now obliged to set --param vect-max-version-for-alias-checks to values as large as 100. c++ -Ofast -ftree-vectorizer-verbose=1 -c Arena.cpp -mtune=corei7 --param vect-max-version-for-alias-checks=10 Analyzing loop at Arena.cpp:14 Vectorizing loop at Arena.cpp:14 14: LOOP VECTORIZED. Arena.cpp:18: note: vectorized 1 loops in function. Analyzing loop at Arena.cpp:14 Vectorizing loop at Arena.cpp:14 14: created 2 versioning for alias checks. 14: LOOP VECTORIZED. Arena.cpp:22: note: vectorized 1 loops in function. if I set --param vect-max-version-for-alias-checks=1 it will not vectorize sumS. At the end I do not see any runtime check in the generated code! otool -v -t -V -X Arena.o __Z4sum2v: leaq _mem+0x00001000(%rip),%rax leaq _mem+0x00002000(%rip),%rdx nop movaps 0x00001000(%rax),%xmm0 addps (%rax),%xmm0 movaps %xmm0,0xfffff000(%rax) addq $0x10,%rax cmpq %rdx,%rax jne 0x00000010 repz/ret nopl __Z4sum2v(%rax) __Z4sumSv: leaq _mem+0x00001000(%rip),%rax leaq _mem+0x00002000(%rip),%rdx nop movaps 0x00001000(%rax),%xmm0 addps (%rax),%xmm0 movaps %xmm0,0xfffff000(%rax) addq $0x10,%rax cmpq %rdx,%rax jne 0x00000040 repz/ret float mem[4096]; const int N=1024; struct XYZ { float * mem; int n; float * x() { return mem;} float * y() { return x()+n;} float * z() { return y()+n;} }; inline void sum(float * x, float * y, float * z, int n) { for (int i=0;i!=n; ++i) x[i]=y[i]+z[i]; } void sum2() { sum(mem,mem+N,mem+2*N,N); } void sumS() { XYZ xyz; xyz.mem=mem; xyz.n=N; sum(xyz.x(),xyz.y(),xyz.z(),xyz.n); }
next reply other threads:[~2011-10-12 8:08 UTC|newest] Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top 2011-10-12 8:08 vincenzo.innocente at cern dot ch [this message] 2011-10-12 11:32 ` [Bug tree-optimization/50698] " rguenth at gcc dot gnu.org 2011-10-12 14:41 ` rguenth at gcc dot gnu.org 2011-10-12 17:01 ` vincenzo.innocente at cern dot ch 2011-10-13 9:01 ` rguenth at gcc dot gnu.org 2011-10-13 9:01 ` rguenth at gcc dot gnu.org 2011-10-15 13:40 ` vincenzo.innocente at cern dot ch 2011-10-17 9:26 ` rguenther at suse dot de
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-50698-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).