http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58041
--- Comment #15 from Bill Schmidt <wschmidt at gcc dot gnu.org> ---
Bernd, Mikael, Martin: Could you please test this on your respective targets?
Index: gcc/gimple-ssa-strength-reduction.c
===================================================================
--- gcc/gimple-ssa-strength-reduction.c (revision 201413)
+++ gcc/gimple-ssa-strength-reduction.c (working copy)
@@ -845,6 +845,8 @@ slsr_process_ref (gimple gs)
int unsignedp, volatilep;
double_int index;
slsr_cand_t c;
+ unsigned HOST_WIDE_INT misalign;
+ unsigned align;
if (gimple_vdef (gs))
ref_expr = gimple_assign_lhs (gs);
@@ -857,6 +859,16 @@ slsr_process_ref (gimple gs)
&& DECL_BIT_FIELD (TREE_OPERAND (ref_expr, 1))))
return;
+ /* If this reference doesn't meet alignment restrictions, don't
+ make it a candidate. */
+ get_object_alignment_1 (ref_expr, &align, &misalign);
+
+ if (misalign != 0)
+ align = (misalign & -misalign);
+
+ if (align < TYPE_ALIGN (TREE_TYPE (ref_expr)))
+ return;
+
base = get_inner_reference (ref_expr, &bitsize, &bitpos, &offset, &mode,
&unsignedp, &volatilep, false);
index = double_int::from_uhwi (bitpos);
Thanks,
Bill