[PATCH] Avoid changing DR for scatter/gather refs
Richard Biener
rguenther@suse.de
Mon Jun 25 09:29:00 GMT 2018
On Sun, 24 Jun 2018, Eric Botcazou wrote:
> > 2018-06-21 Richard Biener <rguenther@suse.de>
> >
> > * tree-data-ref.c (dr_step_indicator): Handle NULL DR_STEP.
> > * tree-vect-data-refs.c (vect_analyze_possibly_independent_ddr):
> > Avoid calling vect_mark_for_runtime_alias_test with gathers or scatters.
> > (vect_analyze_data_ref_dependence): Re-order checks to deal with
> > NULL DR_STEP.
> > (vect_record_base_alignments): Do not record base alignment
> > for gathers or scatters.
> > (vect_compute_data_ref_alignment): Drop return value that is always
> > true. Bail out early for gathers or scatters.
> > (vect_enhance_data_refs_alignment): Bail out early for gathers
> > or scatters.
> > (vect_find_same_alignment_drs): Likewise.
> > (vect_analyze_data_refs_alignment): Remove dead code.
> > (vect_slp_analyze_and_verify_node_alignment): Likewise.
> > (vect_analyze_data_refs): For possible gathers or scatters do
> > not create an alternate DR, just check their possible validity
> > and mark them. Adjust DECL_NONALIASED handling to not rely
> > on DR_BASE_ADDRESS.
> > * tree-vect-loop-manip.c (vect_update_inits_of_drs): Do not
> > update inits of gathers or scatters.
> > * tree-vect-patterns.c (vect_recog_mask_conversion_pattern):
> > Also copy gather/scatter flag to pattern vinfo.
>
> This breaks the attached testcase sso9.adb compiled at -O3:
>
> +===========================GNAT BUG DETECTED==============================+
> | 9.0.0 20180621 (experimental) [trunk revision 261832] (x86_64-suse-linux)
> GCC error:|
> | in vect_check_gather_scatter, at tree-vect-data-refs.c:3733 |
> | Error detected around /home/eric/svn/gcc/gcc/testsuite/gnat.dg/sso9.adb:6:1|
> | Please submit a bug report; see https://gcc.gnu.org/bugs/ . |
Ah, ok. So currently data-ref analysis in dr_analyze_innermost punts
on reverse storage order accesses. Before this patch the scatter/gather
case re-analyzed the ref w/o loop context and the of course failed
again because of that. Now we treat it as possibly scatter/gather
and ask vect_check_gather_scatter whether it is really ok. That does
base = get_inner_reference (base, &pbitsize, &pbitpos, &off, &pmode,
&punsignedp, &reversep, &pvolatilep);
gcc_assert (base && !reversep);
but of course both reversep can now happen. (I think get_inner_reference
can never return NULL)
So the following should fix it, testing in progress.
Richard.
2018-06-25 Richard Biener <rguenther@suse.de>
* tree-vect-data-refs.c (vect_check_gather_scatter): Fail
for reverse storage order accesses rather than asserting
they cannot happen here.
Index: gcc/tree-vect-data-refs.c
===================================================================
--- gcc/tree-vect-data-refs.c (revision 262005)
+++ gcc/tree-vect-data-refs.c (working copy)
@@ -3730,7 +3730,9 @@ vect_check_gather_scatter (gimple *stmt,
that can be gimplified before the loop. */
base = get_inner_reference (base, &pbitsize, &pbitpos, &off, &pmode,
&punsignedp, &reversep, &pvolatilep);
- gcc_assert (base && !reversep);
+ if (reversep)
+ return false;
+
poly_int64 pbytepos = exact_div (pbitpos, BITS_PER_UNIT);
if (TREE_CODE (base) == MEM_REF)
More information about the Gcc-patches
mailing list