[Bug tree-optimization/49444] IV-OPTs changes an unaligned loads into aligned loads incorrectly

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Jun 17 09:06:00 GMT 2011


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

--- Comment #4 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-06-17 09:06:22 UTC ---
(In reply to comment #3)
> Something like this:
> Index: tree-ssa-loop-ivopts.c
> ===================================================================
> --- tree-ssa-loop-ivopts.c    (revision 61384)
> +++ tree-ssa-loop-ivopts.c    (working copy)
> @@ -6066,6 +6066,8 @@ rewrite_use_address (struct ivopts_data
>    tree base_hint = NULL_TREE;
>    tree ref, iv;
>    bool ok;
> +  unsigned align;
> +  tree type;
> 
>    adjust_iv_update_pos (cand, use);
>    ok = get_computation_aff (data->current_loop, use, cand, use->stmt, &aff);
> @@ -6087,7 +6089,10 @@ rewrite_use_address (struct ivopts_data
>      base_hint = var_at_stmt (data->current_loop, cand, use->stmt);
> 
>    iv = var_at_stmt (data->current_loop, cand, use->stmt);
> -  ref = create_mem_ref (&bsi, TREE_TYPE (*use->op_p), &aff,
> +  align = get_object_alignment (*use->op_p, BIGGEST_ALIGNMENT);
> +  type = TREE_TYPE (*use->op_p);
> +  type = build_aligned_type (type, align);
> +  ref = create_mem_ref (&bsi, type, &aff,
>              reference_alias_ptr_type (*use->op_p),
>              iv, base_hint, data->speed);
>    copy_ref_info (ref, *use->op_p);

Well, that will then still run into the indirect-ref issue as
the expansion for target-mem-refs and mem-refs works the same way.
Only targets that support movmisalign will generate unaligned
loads (which targets currently only define for vector modes I think).



More information about the Gcc-bugs mailing list