public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/50067] [4.7 Regression] Wrong code with -fpredictive-commoning
Date: Fri, 19 Aug 2011 13:46:00 -0000	[thread overview]
Message-ID: <bug-50067-4-TnyNKXOVgf@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-50067-4@http.gcc.gnu.org/bugzilla/>

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50067

--- Comment #10 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-08-19 13:36:49 UTC ---
Testcase showing that stripping the offset for the indirect base is bogus:

extern int memcmp(const void *, const void *, __SIZE_TYPE__);
extern void abort (void);
short a[33] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31 };
short b[33] = { 0, };
int main()
{
  int i;
  for (i = 0; i < 64; ++i)
    {
      (*((char(*)[])&a[1]))[i] = (*((char(*)[])&a[0]))[i+1];
    }
  if (memcmp (&a, &b, sizeof (a)) != 0)
    abort ();
  return 0;
}

is vectorized because:

Creating dr for MEM[(char[<unknown>] *)&a][i_5]
analyze_innermost: success.
        base_address: &a
        offset from base address: 0
        constant offset from base address: 1
        step: 1
        aligned to: 128
        base_object: MEM[(char[<unknown>] *)&a]
Creating dr for MEM[(char[<unknown>] *)&a + 2B][i_15]
analyze_innermost: success.
        base_address: &a
        offset from base address: 0
        constant offset from base address: 2
        step: 1
        aligned to: 128
        base_object: MEM[(char[<unknown>] *)&a]
(compute_affine_dependence
  (stmt_a =
D.2739_6 = MEM[(char[<unknown>] *)&a][i_5];
)
  (stmt_b =
MEM[(char[<unknown>] *)&a + 2B][i_15] = D.2739_6;
)
(subscript_dependence_tester
(analyze_overlapping_iterations
  (chrec_a = {1, +, 1}_1)
  (chrec_b = {0, +, 1}_1)
(analyze_siv_subscript
(analyze_subscript_affine_affine
  (overlaps_a = [0 + 1 * x_1]
)
  (overlaps_b = [1 + 1 * x_1]
)
)
)
  (overlap_iterations_a = [0 + 1 * x_1]
)
  (overlap_iterations_b = [1 + 1 * x_1]
)
)
(analyze_overlapping_iterations
  (chrec_a = 0B)
  (chrec_b = 2B)
(analyze_ziv_subscript
)
  (overlap_iterations_a = no dependence
)
  (overlap_iterations_b = no dependence
)
)
(dependence classified: scev_known)
)
)

well - that access_fn created for the indirect base is thought to be
"independent" on any of the other access_fns:

(Data Dep:
#(Data Ref:
#  bb: 3
#  stmt: D.2739_20 = MEM[(char[<unknown>] *)&a][i_19];
#  ref: MEM[(char[<unknown>] *)&a][i_19];
#  base_object: MEM[(char[<unknown>] *)&a];
#  Access function 0: {1, +, 1}_2
#  Access function 1: 0B
#)
#(Data Ref:
#  bb: 3
#  stmt: MEM[(char[<unknown>] *)&a + 2B][i_10] = D.2739_20;
#  ref: MEM[(char[<unknown>] *)&a + 2B][i_10];
#  base_object: MEM[(char[<unknown>] *)&a];
#  Access function 0: {0, +, 1}_2
#  Access function 1: 2B
#)
    (no dependence)

that's clearly bogus.


  parent reply	other threads:[~2011-08-19 13:37 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-13  0:01 [Bug tree-optimization/50067] New: " arthur.j.odwyer at gmail dot com
2011-08-14  9:49 ` [Bug tree-optimization/50067] [4.7 Regression] " rguenth at gcc dot gnu.org
2011-08-18 11:22 ` jakub at gcc dot gnu.org
2011-08-18 11:31 ` jakub at gcc dot gnu.org
2011-08-18 14:14 ` jakub at gcc dot gnu.org
2011-08-19  9:18 ` rguenth at gcc dot gnu.org
2011-08-19 11:24 ` rguenth at gcc dot gnu.org
2011-08-19 11:52 ` jakub at gcc dot gnu.org
2011-08-19 11:55 ` rguenth at gcc dot gnu.org
2011-08-19 12:59 ` rguenth at gcc dot gnu.org
2011-08-19 13:46 ` rguenth at gcc dot gnu.org [this message]
2011-08-19 14:26 ` rguenth at gcc dot gnu.org
2011-08-19 14:29 ` rguenth at gcc dot gnu.org
2011-08-22  8:53 ` rguenth at gcc dot gnu.org
2011-08-22  9:40 ` rguenth at gcc dot gnu.org
2011-08-24 10:12 ` rguenth at gcc dot gnu.org
2011-08-24 10:17 ` rguenth at gcc dot gnu.org

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-50067-4-TnyNKXOVgf@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: link
Be 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).