[Bug tree-optimization/66598] [4.9/5 Regression] With -O3 gcc incorrectly assumes aligned SSE instructions (e.g. movapd) can be used
rguenth at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Nov 26 12:54:00 GMT 2015
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66598
--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
The relevant hunk is the following but as it requires us to know the
final vectorization factor it requires us to re-order (and split)
the pipeline quite a bit. r223670 has bits of the prerequesites but not all
and r224598 has the fix below (and some unrelated bits).
Index: gcc/tree-vect-data-refs.c
===================================================================
--- gcc/tree-vect-data-refs.c (revision 230924)
+++ gcc/tree-vect-data-refs.c (working copy)
@@ -701,21 +701,22 @@ vect_compute_data_ref_alignment (struct
}
}
- /* Similarly, if we're doing basic-block vectorization, we can only use
- base and misalignment information relative to an innermost loop if the
- misalignment stays the same throughout the execution of the loop.
- As above, this is the case if the stride of the dataref evenly divides
- by the vector size. */
- if (!loop)
+ /* Similarly we can only use base and misalignment information relative to
+ an innermost loop if the misalignment stays the same throughout the
+ execution of the loop. As above, this is the case if the stride of
+ the dataref evenly divides by the vector size. */
+ else
{
tree step = DR_STEP (dr);
- HOST_WIDE_INT dr_step = TREE_INT_CST_LOW (step);
+ unsigned vf = loop ? LOOP_VINFO_VECT_FACTOR (loop_vinfo) : 1;
- if (dr_step % GET_MODE_SIZE (TYPE_MODE (vectype)) != 0)
+ if (tree_fits_shwi_p (step)
+ && ((tree_to_shwi (step) * vf)
+ % GET_MODE_SIZE (TYPE_MODE (vectype)) != 0))
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "SLP: step doesn't divide the vector-size.\n");
+ "step doesn't divide the vector-size.\n");
misalign = NULL_TREE;
}
}
More information about the Gcc-bugs
mailing list