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: Fri, 16 Dec 2011 00:33:10 +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 #6 from Andrew Pinski <pinskia at gcc dot gnu.org> 2011-12-16 00:33:10 UTC ---
This is the patch which I ended up with:
Index: tree-ssa-loop-ivopts.c
===================================================================
--- tree-ssa-loop-ivopts.c (revision 61449)
+++ tree-ssa-loop-ivopts.c (revision 61858)
@@ -6066,6 +6066,7 @@ rewrite_use_address (struct ivopts_data
tree base_hint = NULL_TREE;
tree ref, iv;
bool ok;
+ tree type;
adjust_iv_update_pos (cand, use);
ok = get_computation_aff (data->current_loop, use, cand, use->stmt, &aff);
@@ -6087,7 +6088,13 @@ 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,
+ type = TREE_TYPE (*use->op_p);
+ if (TREE_CODE (*use->op_p) == COMPONENT_REF)
+ {
+ unsigned align = DECL_ALIGN (TREE_OPERAND (*use->op_p, 1));
+ 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);
--- CUT ---
I also implemented on mips the misalignedmove patterns too.