This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Patches ping
Hello,
> > > and from the last month:
> > >
> > > http://gcc.gnu.org/ml/gcc-patches/2005-04/msg01810.html
> > > -- the patch to verify that statements operands are up-to-date
> >
> > Sorry, I forgot about this one. The underlying implementation is now
> > completely different, I will update the tree-ssa-operands part of your
> > patch today.
>
> Remind me, didn't you say when you first implemented this that it showed
> a bunch of failures in the vectorizer? I seem to recall that.
yes.
> Patch is attached. It bootstraps on i686-pc-linux-gnu.
>
> I presume other people want to see this checked in even with the
> additional testsuite failures? They are all with -ftree-vectorize. Or we
> can hold off until the vectorizer is fixed.
The problem is known for about a month now, and nobody bothered to do
anything about it. Perhaps making vectorizer ICE on basically any input will
persuade some of the vectorizer developers to finally fix it :-)
Zdenek
> < FAIL: gcc.dg/tree-ssa/gen-vect-11.c (test for excess errors)
> < FAIL: gcc.dg/tree-ssa/gen-vect-11a.c (test for excess errors)
> < FAIL: gcc.dg/tree-ssa/gen-vect-2.c (test for excess errors)
> < FAIL: gcc.dg/tree-ssa/gen-vect-25.c (test for excess errors)
> < FAIL: gcc.dg/tree-ssa/ltrans-1.c (test for excess errors)
> < FAIL: gcc.dg/vect/pr18400.c (test for excess errors)
> < FAIL: gcc.dg/vect/pr20122.c (test for excess errors)
> < FAIL: gcc.dg/vect/pr20122.c scan-tree-dump-times vectorized 1 loops 2
> < FAIL: gcc.dg/vect/vect-1.c (test for excess errors)
> < FAIL: gcc.dg/vect/vect-17.c (test for excess errors)
> < FAIL: gcc.dg/vect/vect-18.c (test for excess errors)
> < FAIL: gcc.dg/vect/vect-19.c (test for excess errors)
> < FAIL: gcc.dg/vect/vect-2.c (test for excess errors)
> < FAIL: gcc.dg/vect/vect-20.c (test for excess errors)
> < FAIL: gcc.dg/vect/vect-22.c (test for excess errors)
> < FAIL: gcc.dg/vect/vect-25.c (test for excess errors)
> < FAIL: gcc.dg/vect/vect-27.c (test for excess errors)
> < FAIL: gcc.dg/vect/vect-29.c (test for excess errors)
> < FAIL: gcc.dg/vect/vect-3.c (test for excess errors)
> < FAIL: gcc.dg/vect/vect-30.c (test for excess errors)
> < FAIL: gcc.dg/vect/vect-30.c scan-tree-dump-times vectorized 1 loops 2
> < FAIL: gcc.dg/vect/vect-34.c (test for excess errors)
> < FAIL: gcc.dg/vect/vect-38.c (test for excess errors)
> < FAIL: gcc.dg/vect/vect-4.c (test for excess errors)
> < FAIL: gcc.dg/vect/vect-5.c (test for excess errors)
> < FAIL: gcc.dg/vect/vect-6.c (test for excess errors)
> < FAIL: gcc.dg/vect/vect-65.c (test for excess errors)
> < FAIL: gcc.dg/vect/vect-66.c (test for excess errors)
> < FAIL: gcc.dg/vect/vect-69.c (test for excess errors)
> < FAIL: gcc.dg/vect/vect-7.c (test for excess errors)
> < FAIL: gcc.dg/vect/vect-72.c (test for excess errors)
> < FAIL: gcc.dg/vect/vect-8.c (test for excess errors)
> < FAIL: gcc.dg/vect/vect-93.c (test for excess errors)
> < FAIL: gcc.dg/vect/vect-96.c (test for excess errors)
> < FAIL: gcc.dg/vect/vect-97.c (test for excess errors)
> < FAIL: gcc.dg/vect/vect-all.c (test for excess errors)
> < FAIL: gcc.dg/vect/vect-dv-2.c (test for excess errors)
> < FAIL: gcc.dg/vect/vect-ifcvt-1.c (test for excess errors)
> < FAIL: gcc.dg/vect/vect-none.c (test for excess errors)
>
> < # of expected passes 35333
> < # of unexpected failures 41
> ---
> > # of expected passes 35406
> > # of unexpected failures 2
>
> < FAIL: gfortran.dg/vect/vect-1.f90 (test for excess errors)
> < FAIL: gfortran.dg/vect/vect-2.f90 (test for excess errors)
> < FAIL: gfortran.dg/vect/vect-5.f90 (test for excess errors)
> 7309,7310c7309,7310
> < # of expected passes 6647
> < # of unexpected failures 4
> ---
> > # of expected passes 6651
> > # of unexpected failures 1
>
>
> This implements Zdenek's stmt verification routine. With the new
> implementation, all virtual operands are sorted, and reals are in
> order of appearence, so we can simply loop over the operands and
> stash them into a vector, update the stmt, and compare the results
> of a new itreation over the stmt with the old one.
>
> Of course there is a hitch. get_expr_operands is capable of swapping
> a pair of real operand, so we have to add a hack to look for this
> situation where a swap has taken place. ick.
>
> 2005-05-04 Andrew MacLeod <amacleod@redhat.com>
> Zdenek Dvorak <dvorakz@suse.cz>
>
> * tree-ssa-operands.c (stmt_verify_vec): New. Persistent vector for
> verify_stmt_operands to use.
> (init_ssa_operands): Assert that stmt_verify_vec is NULL.
> (fini_ssa_operands): Free stmt_verify_vec if necessary.
> (verify_stmt_operands): New. Verify operands are up to date.
> * tree-ssa-operands.h (verify_stmt_operands): Declare prototype.
> * tree-ssa.c (verify_ssa): call verify_stmt_operands.
>
>
> Index: tree-ssa-operands.c
> ===================================================================
> RCS file: /cvs/gcc/gcc/gcc/tree-ssa-operands.c,v
> retrieving revision 2.80
> diff -c -p -r2.80 tree-ssa-operands.c
> *** tree-ssa-operands.c 3 May 2005 12:19:46 -0000 2.80
> --- tree-ssa-operands.c 4 May 2005 15:32:19 -0000
> *************** static vuse_optype_p free_vuses = NULL;
> *** 164,169 ****
> --- 164,171 ----
> static maydef_optype_p free_maydefs = NULL;
> static mustdef_optype_p free_mustdefs = NULL;
>
> + static VEC(tree, heap) *stmt_verify_vec = NULL;
> +
> /* Initialize a virtual operand build LIST called NAME with NUM elements. */
>
> static inline void
> *************** init_ssa_operands (void)
> *** 401,406 ****
> --- 403,409 ----
> opbuild_initialize_virtual (&build_v_may_defs, 25, "build_v_may_defs");
> opbuild_initialize_virtual (&build_v_must_defs, 25, "build_v_must_defs");
> gcc_assert (operand_memory == NULL);
> + gcc_assert (stmt_verify_vec == NULL);
> operand_memory_index = SSA_OPERAND_MEMORY_SIZE;
> ops_active = true;
> }
> *************** fini_ssa_operands (void)
> *** 440,445 ****
> --- 443,450 ----
> ggc_free (ro_call_vuses);
> ro_call_vuses = NULL;
> }
> + if (stmt_verify_vec)
> + VEC_free (tree, heap, stmt_verify_vec);
> ops_active = false;
> }
>
> *************** finalize_ssa_uses (tree stmt)
> *** 579,585 ****
>
> /* If the pointer to the operand is the statement itself, something is
> wrong. It means that we are pointing to a local variable (the
> ! initial call to get_stmt_operands does not pass a pointer to a
> statement). */
> for (x = 0; x < num; x++)
> gcc_assert (*(opbuild_elem_real (&build_uses, x)) != stmt);
> --- 584,590 ----
>
> /* If the pointer to the operand is the statement itself, something is
> wrong. It means that we are pointing to a local variable (the
> ! initial call to update_stmt_operands does not pass a pointer to a
> statement). */
> for (x = 0; x < num; x++)
> gcc_assert (*(opbuild_elem_real (&build_uses, x)) != stmt);
> *************** build_ssa_operands (tree stmt)
> *** 994,1056 ****
> }
>
> start_ssa_stmt_operands ();
> -
> parse_ssa_operands (stmt);
> -
> finalize_ssa_stmt_operands (stmt);
> }
>
>
> ! /* Free any operands vectors in OPS. */
> ! #if 0
> ! static void
> ! free_ssa_operands (stmt_operands_p ops)
> ! {
> ! ops->def_ops = NULL;
> ! ops->use_ops = NULL;
> ! ops->maydef_ops = NULL;
> ! ops->mustdef_ops = NULL;
> ! ops->vuse_ops = NULL;
> ! while (ops->memory.next != NULL)
> ! {
> ! operand_memory_p tmp = ops->memory.next;
> ! ops->memory.next = tmp->next;
> ! ggc_free (tmp);
> ! }
> ! }
> ! #endif
> !
> !
> ! /* Get the operands of statement STMT. Note that repeated calls to
> ! get_stmt_operands for the same statement will do nothing until the
> ! statement is marked modified by a call to mark_stmt_modified(). */
>
> void
> update_stmt_operands (tree stmt)
> {
> stmt_ann_t ann = get_stmt_ann (stmt);
> ! /* If get_stmt_operands is called before SSA is initialized, dont
> do anything. */
> if (!ssa_operands_active ())
> return;
> /* The optimizers cannot handle statements that are nothing but a
> _DECL. This indicates a bug in the gimplifier. */
> gcc_assert (!SSA_VAR_P (stmt));
> -
> gcc_assert (ann->modified);
>
> timevar_push (TV_TREE_OPS);
> -
> build_ssa_operands (stmt);
>
> ! /* Clear the modified bit for STMT. Subsequent calls to
> ! get_stmt_operands for this statement will do nothing until the
> ! statement is marked modified by a call to mark_stmt_modified(). */
> ann->modified = 0;
> -
> timevar_pop (TV_TREE_OPS);
> }
>
>
> /* Copies virtual operands from SRC to DST. */
>
> --- 999,1083 ----
> }
>
> start_ssa_stmt_operands ();
> parse_ssa_operands (stmt);
> finalize_ssa_stmt_operands (stmt);
> }
>
>
> ! /* Get the operands of statement STMT. */
>
> void
> update_stmt_operands (tree stmt)
> {
> stmt_ann_t ann = get_stmt_ann (stmt);
> ! /* If update_stmt_operands is called before SSA is initialized, dont
> do anything. */
> if (!ssa_operands_active ())
> return;
> /* The optimizers cannot handle statements that are nothing but a
> _DECL. This indicates a bug in the gimplifier. */
> gcc_assert (!SSA_VAR_P (stmt));
> gcc_assert (ann->modified);
>
> timevar_push (TV_TREE_OPS);
> build_ssa_operands (stmt);
>
> ! /* Clear the modified bit for STMT. */
> ann->modified = 0;
> timevar_pop (TV_TREE_OPS);
> }
>
> +
> + /* Verify the operands are up to date in STMT. */
> +
> + void
> + verify_stmt_operands (tree stmt)
> + {
> + ssa_op_iter iter;
> + tree t, old;
> + unsigned i;
> + bool swapped = false;
> +
> + if (!ssa_operands_active ())
> + return;
> +
> + if (!stmt_verify_vec)
> + stmt_verify_vec = VEC_alloc (tree, heap, 100);
> + else
> + VEC_truncate (tree, stmt_verify_vec, 0);
> +
> + /* Operands are ordered, so simply stash them into a vector. */
> + FOR_EACH_SSA_TREE_OPERAND (t, stmt, iter, SSA_OP_ALL_OPERANDS)
> + VEC_safe_push (tree, heap, stmt_verify_vec, t);
> +
> + update_stmt (stmt);
> +
> + i = 0;
> + /* Now compare each vector element to the rebuilt operands. */
> + FOR_EACH_SSA_TREE_OPERAND (t, stmt, iter, SSA_OP_ALL_OPERANDS)
> + {
> + VEC_iterate (tree, stmt_verify_vec, i++, old);
> + /* get_expr_operands can swap real operands, so look for swapped
> + operands. */
> + if (swapped)
> + {
> + gcc_assert (VEC_index (tree, stmt_verify_vec, i - 2) == t);
> + swapped = false;
> + continue;
> + }
> + if (old != t && i < VEC_length (tree, stmt_verify_vec)
> + && VEC_index (tree, stmt_verify_vec, i) == t)
> + {
> + swapped = true;
> + continue;
> + }
> + /* OLD will be NULL and miscompare if the vector iteration ends early, */
> + gcc_assert (old == t);
> + }
> +
> + gcc_assert (i == VEC_length (tree, stmt_verify_vec));
> + }
> +
>
> /* Copies virtual operands from SRC to DST. */
>
> Index: tree-ssa-operands.h
> ===================================================================
> RCS file: /cvs/gcc/gcc/gcc/tree-ssa-operands.h,v
> retrieving revision 2.15
> diff -c -p -r2.15 tree-ssa-operands.h
> *** tree-ssa-operands.h 3 May 2005 12:19:47 -0000 2.15
> --- tree-ssa-operands.h 4 May 2005 15:32:19 -0000
> *************** typedef struct stmt_operands_d *stmt_ope
> *** 154,159 ****
> --- 154,160 ----
> extern void init_ssa_operands (void);
> extern void fini_ssa_operands (void);
> extern void update_stmt_operands (tree);
> + extern void verify_stmt_operands (tree);
> extern bool verify_imm_links (FILE *f, tree var);
>
> extern void copy_virtual_operands (tree, tree);
> Index: tree-ssa.c
> ===================================================================
> RCS file: /cvs/gcc/gcc/gcc/tree-ssa.c,v
> retrieving revision 2.93
> diff -c -p -r2.93 tree-ssa.c
> *** tree-ssa.c 3 May 2005 12:19:48 -0000 2.93
> --- tree-ssa.c 4 May 2005 15:32:19 -0000
> *************** verify_ssa (bool check_modified_stmt)
> *** 755,760 ****
> --- 755,763 ----
>
> FOR_EACH_SSA_TREE_OPERAND (op, stmt, iter, SSA_OP_ALL_DEFS)
> bitmap_set_bit (names_defined_in_bb, SSA_NAME_VERSION (op));
> +
> + /* Finally, make sure the operands are properly up to date. */
> + verify_stmt_operands (stmt);
> }
>
> bitmap_clear (names_defined_in_bb);