public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/64365] New: Predictive commoning after loop vectorization produces incorrect code.
@ 2014-12-20  0:25 congh at google dot com
  2015-01-13 22:15 ` [Bug tree-optimization/64365] " congh at google dot com
                   ` (15 more replies)
  0 siblings, 16 replies; 17+ messages in thread
From: congh at google dot com @ 2014-12-20  0:25 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64365

            Bug ID: 64365
           Summary: Predictive commoning after loop vectorization produces
                    incorrect code.
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: congh at google dot com

Compiling the following loop with -O3 on x86-64 produces incorrect code:


void foo(int *in) {
  for (int i = 14; i >= 10; i--) {
    in[i - 8] -= in[i];
    in[i - 5] += in[i] * 2;
    in[i - 4] += in[i];
  }
}


The incorrect code appears starting from pcom pass. Note that after this loop
is vectorized there exists read-after-write data dependence between the second
and third statements in the loop. The correct way to get the vector from in[i -
4] in the third statement is reading the memory after the write from the second
statement. However, in pcom pass, that vector is actually preloaded before the
loop. I think pcom ignores the aliasing between the memory addresses of vector
types (in this case MEM[&{in[i-3] : in[i-0]}] and MEM[&{in[i-5] : in[i-1]}].


^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2015-02-19 14:14 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-20  0:25 [Bug tree-optimization/64365] New: Predictive commoning after loop vectorization produces incorrect code congh at google dot com
2015-01-13 22:15 ` [Bug tree-optimization/64365] " congh at google dot com
2015-01-14  9:00 ` rguenth at gcc dot gnu.org
2015-01-14 12:14 ` rguenth at gcc dot gnu.org
2015-01-14 12:15 ` [Bug tree-optimization/64365] [5 Regression] " rguenth at gcc dot gnu.org
2015-01-14 12:36 ` jakub at gcc dot gnu.org
2015-01-14 12:44 ` [Bug tree-optimization/64365] [4.9/5 " rguenth at gcc dot gnu.org
2015-01-14 13:27 ` rguenth at gcc dot gnu.org
2015-01-15  8:41 ` rguenth at gcc dot gnu.org
2015-01-15 10:31 ` [Bug tree-optimization/64365] [4.9 " rguenth at gcc dot gnu.org
2015-01-15 18:15 ` congh at google dot com
2015-01-22 22:59 ` brooks at gcc dot gnu.org
2015-01-23  9:13 ` rguenther at suse dot de
2015-01-29 19:58 ` brooks at gcc dot gnu.org
2015-01-30  3:25 ` brooks at gcc dot gnu.org
2015-02-19 14:14 ` rguenth at gcc dot gnu.org
2015-02-19 14:14 ` rguenth at gcc dot gnu.org

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).