http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58041
--- Comment #11 from Bill Schmidt <wschmidt at gcc dot gnu.org> --- Hi Martin, Your assumptions are correct, but I'm not sure this is the best place to handle it. It looks like what you are doing is replacing one already correct memory reference with another, both of which will generate somewhat nasty code. Therefore there isn't much reason to do the transformation at all in the first place. I think I would rather analyze the reference when considering adding the reference to the candidate table, and leaving it out of consideration altogether. What do you think? For example, I'm looking at adding the following ahead of the call to restructure_reference in slsr_process_ref: /* If this reference doesn't meet alignment restrictions, don't make it a candidate. Logic similar to that in tree-ssa-loop-ivopts.c: may_be_unaligned_p(), without the STEP check. */ if (mode != BLKmode) { tree base_type = TREE_TYPE (base); unsigned base_align = get_object_alignment (base); unsigned mode_align = GET_MODE_ALIGNMENT (mode); base_align = MAX (base_align, TYPE_ALIGN (base_type)); if (base_align < mode_align || (bitpos % mode_align) != 0 || (bitpos % BITS_PER_UNIT) != 0) return; if (offset && (highest_pow2_factor (offset) * BITS_PER_UNIT) < mode_align) return; }