[patch] PR 18009: vectorizer ICE fix

Dorit Naishlos DORIT@il.ibm.com
Sun Oct 17 22:07:00 GMT 2004


The attached patch fixes the ICE reported in PR 18009. The problem is
related to loop peeling - when peeling is applied, the alignment of the
data references in the loop, which is recorded in DR_MISALIGNMENT, changes.
It is being accordingly updated, but too late: only after peeling is
applied DR_MISALIGNMENT is fixed; the analysis steps before that have
outdated alignment information - DR_MISALIGNMENT may indicate that an
access is aligned, the analysis step will let vectorization proceed, then
when peeling is applied DR_MISALIGNMENT is fixed to indicate that the
access is unaligned, and when we try to vectorize the stmt we ICE if we
can't support the misaligned access.

To fix this we update DR_MISALIGNMENT earlier, when we decide to peel. At
this point we also check for available alignment support (this check was
moved to a separate function - vect_supportable_dr_alignment; we also set
STMT_VINFO_VECTYPE earlier as it is needed by
vect_supportable_dr_alignment). Also included a minor cleanup -
LOOP_UNALIGNED_DR doesn't need to hold more than one data_reference (we
don't need to record more than one DR to guide the peeling).

tested on ppc-darwin and i686-pc-linux-gnu.

ok for mainline?

thanks,

dorit

        * tree-vectorizer.h (enum dr_alignment_support): New type.
        (MAX_NUMBER_OF_UNALIGNED_DATA_REFS): Removed.
        (LOOP_UNALIGNED_DR): Replaced with LOOP_VINFO_UNALIGNED_DR and
holds a
        single data_reference (instead of an array of references).
        * tree-vectorizer.c (new_loop_vec_info): Likewise.
        (vect_gen_niters_for_prolog_loop): Likewise.
        (vect_update_inits_of_drs): Likewise.

        (vect_update_inits_of_drs): Setting of DR_MISALIGNMENT moved to
        vect_enhance_data_refs_alignment.
        (vect_do_peeling_for_alignment): Likewise.
        (vect_enhance_data_refs_alignment): Decide if and by how much to
peel;
        this functionality used to be in vect_analyze_data_refs_alignment.
        Also update DR_MISALIGNMENT due to peeling; this functionality used
to
        be in vect_update_inits_of_drs and vect_do_peeling_for_alignment).
        (vect_analyze_data_refs_alignment): Decision on whether and by how
much
        to peel moved to vect_enhance_data_refs_alignment. Call
        vect_supportable_dr_alignment.

        (vect_compute_data_ref_alignment): Set STMT_VINFO_VECTYPE.
        (vect_compute_data_refs_alignment): Return bool. Consider the
return value
        of vect_compute_data_ref_alignment and return true/false
accordingly.
        (vect_enhance_data_refs_alignment): Consider the return value of
        vect_compute_data_refs_alignment and return true/false accordingly.

        (vect_supportable_dr_alignment): New function.
        (vectorizable_store): Call vect_supportable_dr_alignment.
        (vectorizable_load): Call vect_supportable_dr_alignment. Alignment
        support checks moved from here to vect_supportable_dr_alignment.

        (vect_transform_loop): Avoid 80 columns overflow.

(See attached file: vectfix.oct17)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vectfix.oct17
Type: application/octet-stream
Size: 25100 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20041017/84b65296/attachment.obj>


More information about the Gcc-patches mailing list