This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/49444] IV-OPTs changes an unaligned loads into aligned loads incorrectly
- From: "pinskia at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 16 Jun 2011 21:10:20 +0000
- Subject: [Bug tree-optimization/49444] IV-OPTs changes an unaligned loads into aligned loads incorrectly
- Auto-submitted: auto-generated
- References: <bug-49444-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49444
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> 2011-06-16 21:10:18 UTC ---
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);