This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fixed a regression caused by my vect_recog_mixed_size_cond_pattern changes (PR tree-optimization/50650)


On Fri, 7 Oct 2011, Jakub Jelinek wrote:

> Hi!
> 
> Calling vect_is_simple_cond from the pattern recognized was a bad idea,
> as it calls vect_is_simple_use_1 rather than vect_is_simple_use and the
> former looks at STMT_VINFO_VECTYPE which by that time is only set
> for the data ref stmts (which is why in my test it worked well, that
> one did (a[i] < b[i]) ? ... : .... and surprisingly nothing in the testsuite
> caught that either).
> 
> Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux.
> Ok for trunk?

Ok.

Thanks,
Richard.

> 2011-10-07  Jakub Jelinek  <jakub@redhat.com>
> 
> 	PR tree-optimization/50650
> 	* tree-vect-patterns.c (vect_recog_mixed_size_cond_pattern): Don't
> 	call vect_is_simple_cond here, instead fail if cond_expr isn't
> 	COMPARISON_CLASS_P or if get_vectype_for_scalar_type returns NULL
> 	for cond_expr's first operand.
> 	* tree-vect-stmts.c (vect_is_simple_cond): Static again.
> 	* tree-vectorizer.h (vect_is_simple_cond): Remove prototype.
> 
> 	* gcc.c-torture/compile/pr50650.c: New test.
> 
> --- gcc/tree-vect-patterns.c.jj	2011-10-07 10:03:28.000000000 +0200
> +++ gcc/tree-vect-patterns.c	2011-10-07 10:18:58.000000000 +0200
> @@ -1269,8 +1269,12 @@ vect_recog_mixed_size_cond_pattern (VEC 
>        || TREE_CODE (else_clause) != INTEGER_CST)
>      return NULL;
>  
> -  if (!vect_is_simple_cond (cond_expr, loop_vinfo, &comp_vectype)
> -      || !comp_vectype)
> +  if (!COMPARISON_CLASS_P (cond_expr))
> +    return NULL;
> +
> +  comp_vectype
> +    = get_vectype_for_scalar_type (TREE_TYPE (TREE_OPERAND (cond_expr, 0)));
> +  if (comp_vectype == NULL_TREE)
>      return NULL;
>  
>    type = gimple_expr_type (last_stmt);
> --- gcc/tree-vect-stmts.c.jj	2011-10-07 10:03:28.000000000 +0200
> +++ gcc/tree-vect-stmts.c	2011-10-07 10:04:45.000000000 +0200
> @@ -4698,7 +4698,7 @@ vectorizable_load (gimple stmt, gimple_s
>     Returns whether a COND can be vectorized.  Checks whether
>     condition operands are supportable using vec_is_simple_use.  */
>  
> -bool
> +static bool
>  vect_is_simple_cond (tree cond, loop_vec_info loop_vinfo, tree *comp_vectype)
>  {
>    tree lhs, rhs;
> --- gcc/tree-vectorizer.h.jj	2011-10-07 10:03:28.000000000 +0200
> +++ gcc/tree-vectorizer.h	2011-10-07 10:04:28.000000000 +0200
> @@ -818,7 +818,6 @@ extern bool vect_transform_stmt (gimple,
>                                   bool *, slp_tree, slp_instance);
>  extern void vect_remove_stores (gimple);
>  extern bool vect_analyze_stmt (gimple, bool *, slp_tree);
> -extern bool vect_is_simple_cond (tree, loop_vec_info, tree *);
>  extern bool vectorizable_condition (gimple, gimple_stmt_iterator *, gimple *,
>                                      tree, int);
>  extern void vect_get_load_cost (struct data_reference *, int, bool,
> --- gcc/testsuite/gcc.c-torture/compile/pr50650.c.jj	2011-10-07 11:12:27.000000000 +0200
> +++ gcc/testsuite/gcc.c-torture/compile/pr50650.c	2011-10-07 11:11:30.000000000 +0200
> @@ -0,0 +1,10 @@
> +/* PR tree-optimization/50650 */
> +
> +unsigned int
> +foo (unsigned int x, unsigned int y)
> +{
> +  int i;
> +  for (i = 8; i--; x <<= 1)
> +    y ^= (x ^ y) & 0x80 ? 79U : 0U;
> +  return y;
> +}
> 
> 	Jakub
> 
> 

-- 
Richard Guenther <rguenther@suse.de>
SUSE / SUSE Labs
SUSE LINUX Products GmbH - Nuernberg - AG Nuernberg - HRB 16746
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]