This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PING][patch,loopiv] misaligned packed array memory access


ok, I see now what you meant, just that we also need to pass the computed offset:

    val1 = fold_build2 (MULT_EXPR, type, step, toffset);
    val = fold_build2 (PLUS_EXPR, base_type, base, val1);

as the base from constant_multiple_of.

I'll see what this gives.

Rgds,
-c

Zdenek Dvorak wrote:
Hi,


I'm not sure, I tried to use only `constant_multiple_of` but didn't succeed without being over-conservative, because we want to check all conditions of alignments of base+step+offset. Furthermore we would need to duplicate most of the may_be_unaligned_p function (call to get_inner_reference).


no, that is not what I ment.  What I had in mind is something like
the following patch (since we compute the step of the reference anyway,
duplicating that in loop_offset_multiple_of seems redundant):

Index: tree-ssa-loop-ivopts.c
===================================================================
*** tree-ssa-loop-ivopts.c (revision 132341)
--- tree-ssa-loop-ivopts.c (working copy)
*************** idx_record_use (tree base, tree *idx,
*** 1391,1400 ****
return true;
}
! /* Returns true if memory reference REF may be unaligned. */
static bool
! may_be_unaligned_p (tree ref)
{
tree base;
tree base_type;
--- 1391,1400 ----
return true;
}
! /* Returns true if memory reference REF with step STEP may be unaligned. */
static bool
! may_be_unaligned_p (tree ref, tree step)
{
tree base;
tree base_type;
*************** may_be_unaligned_p (tree ref)
*** 1404,1409 ****
--- 1404,1410 ----
enum machine_mode mode;
int unsignedp, volatilep;
unsigned base_align;
+ double_int mul;
/* TARGET_MEM_REFs are translated directly to valid MEMs on the target,
thus they are not misaligned. */
*************** may_be_unaligned_p (tree ref)
*** 1424,1429 ****
--- 1425,1433 ----
|| bitpos % BITS_PER_UNIT != 0))
return true;
+ if (!constant_multiple_of (step, build_int_cst (TREE_TYPE (step), GET_MODE_ALIGNMENT (mode)), &mul))
+ return true;
+ return false;
}
*************** find_interesting_uses_address (struct iv
*** 1549,1555 ****
/* Moreover, on strict alignment platforms, check that it is
sufficiently aligned. */
! if (STRICT_ALIGNMENT && may_be_unaligned_p (base))
goto fail;
base = build_fold_addr_expr (base);
--- 1553,1559 ----
/* Moreover, on strict alignment platforms, check that it is
sufficiently aligned. */
! if (STRICT_ALIGNMENT && may_be_unaligned_p (base, step))
goto fail;
base = build_fold_addr_expr (base);




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]