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.

Reply via email to