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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rguenth at gcc dot gnu.org

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
The issue is

t.c:11:15: note:   === vect_prune_runtime_alias_test_list ===
t.c:11:15: note:   can tell at compile time that _3->f and _3->f alias
t.c:8:16: missed:   not vectorized: compilation time alias: _4 = _3->f;
_3->f = _10;

not the load/store-lane.  Changing the source to

void cellUnion_f(RtreeCoord *a1, RtreeCoord *a2, int n) {
  int ii = 0;
  do {
    float tem1 = MIN(a1[ii].f,   a2[ii].f);
    float tem2 = MAX(a1[ii+1].f, a2[ii+1].f);
    a1[ii].f   =  tem1;
    a1[ii+1].f =  tem2;
    ii += 2;
  } while (ii < n);
}

allows vectorizing with a VF == 1 (V2SF).  Placing __restrict on a2 also
helps in a similar way but we seem to be still confused about even

(compute_affine_dependence
  ref_a: *_12.i, stmt_a: _13 = *_12.i;
  ref_b: *_12.i, stmt_b: *_12.i = _14;
) -> dependence analysis failed

Creating dr for *_12.i
analyze_innermost: success.
        base_address: a1_20(D)
        offset from base address: 0
        constant offset from base address: 4
        step: 8
        base alignment: 4
        base misalignment: 0
        offset alignment: 512
        step alignment: 8
        base_object: *_12.i
Creating dr for *_12.i
analyze_innermost: success.
        base_address: a1_20(D)
        offset from base address: 0
        constant offset from base address: 4
        step: 8
        base alignment: 4
        base misalignment: 0
        offset alignment: 512
        step alignment: 8
        base_object: *_12.i

and with

Creating dr for *_5.i
analyze_innermost: success.
        base_address: a1_20(D)
        offset from base address: 0
        constant offset from base address: 0
        step: 8
        base alignment: 4
        base misalignment: 0
        offset alignment: 512
        step alignment: 8
        base_object: *_5.i

having different base objects makes things difficult.

And this is:

      else if (TREE_CODE (ref) == COMPONENT_REF
               && TREE_CODE (TREE_TYPE (TREE_OPERAND (ref, 0))) == RECORD_TYPE)
        {
          /* For COMPONENT_REFs of records (but not unions!) use the
             FIELD_DECL offset as constant access function so we can
             disambiguate a[i].f1 and a[i].f2.  */
          tree off = component_ref_field_offset (ref);
          off = size_binop (PLUS_EXPR,
                            size_binop (MULT_EXPR,

from dr_analyze_innermost, so the reason is you have a union here and
we refrain from touching those (for fear?  I don't exactly remember,
but most definitely if you'd had two different records in the union
we'd get confused big time - it's possibly fine for "scalar" elements
and of elements of same size).

Is this practically relevant?

Reply via email to