This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] [4.3 projects] Verctorizer - versioning for alias
Hello,
> * gcc.dg/vect/vect-vfa-01.c: New.
> * gcc.dg/vect/vect-vfa-02.c: New.
> * gcc.dg/vect/vect-vfa-03.c: New.
> (See attached file: vfa.txt)
> Index: testsuite/gcc.dg/vect/vect-vfa-01.c
> ===================================================================
> --- testsuite/gcc.dg/vect/vect-vfa-01.c (revision 0)
> +++ testsuite/gcc.dg/vect/vect-vfa-01.c (revision 0)
> @@ -0,0 +1,39 @@
> +/* { dg-require-effective-target vect_int } */
> +
> +#include <stdarg.h>
> +#include "tree-vect.h"
> +
> +#define N 16
> +int result[N] = {12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27};
> +int X[N] = {10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25};
> +int Y[N] = {};
> +
> +void
> +foo (int *in, int *out)
> +{
> + int i;
> +
> + for (i = 0; i < N; i++)
> + out[i] = in[i] + 2;
> +}
> +
> +int
> +main (void)
> +{
> + int i;
> +
> + check_vect ();
> +
> + foo (X, Y);
could you also add some test that checks the situation where the IN and
OUT pointers overlap in such a way that the vectorized copy of the loop
would produce wrong results (if it were used)?
> +/* Return TRUE if DDR_NEW is already found in MAY_ALIAS_DDRS list. */
> +static bool
> +vect_is_duplicate_ddr (VEC (ddr_p, heap) * may_alias_ddrs, ddr_p ddr_new)
There should be an empty line between the comment and the function.
> +/* Function vect_create_cond_for_alias_checks.
>
> + Create a conditional expression that represents the run-time checks for
> + overlapping of adress ranges represented by a list of data references
> + relations passed as input.
> +
> + Input:
> + COND_EXPR - input conditional expression. New conditions will be chained
> + logical and operation.
^ with
> + LOOP_VINFO - fields of the loop information are used.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ I am not
sure what this sentence is supposed to mean.
> + part_cond_expr =
> + fold_build2 (TRUTH_OR_EXPR, boolean_type_node,
> + fold_build2 (LT_EXPR, boolean_type_node,
> + fold_build2 (PLUS_EXPR, ptr_type_node,
^^^^^^^^^
should be POINTER_PLUS_EXPR. It is a bit suspicious that this passes
testing, as it should ICE in build2. Can you check why it does not?
> + addr_base_a,
> + segment_length_a),
> + addr_base_b),
> + fold_build2 (LT_EXPR, boolean_type_node,
> + fold_build2 (PLUS_EXPR, ptr_type_node,
Ditto.
> Index: params.def
> ===================================================================
> --- params.def (revision 127316)
> +++ params.def (working copy)
> @@ -485,11 +485,16 @@
> "When set to 1, use expensive methods to eliminate all redundant constraints",
> 0, 0, 1)
>
> -DEFPARAM(PARAM_VECT_MAX_VERSION_CHECKS,
> - "vect-max-version-checks",
> - "Bound on number of runtime checks inserted by the vectorizer's loop versioning",
> +DEFPARAM(PARAM_VECT_MAX_VERSION_FOR_ALIGNMENT_CHECKS,
> + "vect-max-version-for-alignment-checks",
> + "Bound on number of runtime checks inserted by the vectorizer's loop versioning for alignment check",
> 6, 0, 0)
>
> +DEFPARAM(PARAM_VECT_MAX_VERSION_FOR_ALIAS_CHECKS,
> + "vect-max-version-for-alias-checks",
> + "Bound on number of runtime checks inserted by the vectorizer's loop versioning for alias check",
> + 10, 0, 0)
> +
The params should be documented in invoke.texi. Otherwise, the patch is
OK.
Zdenek