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] Fix PR71893


Hi!

On Fri, 15 Jul 2016 15:19:59 +0200 (CEST), Richard Biener <rguenther@suse.de> wrote:
> This PR shows that

(There is also PR71901 suspected to be related; David CCed.)

> array_ref_element_size may apply spurious casts which
> in turn end up confusing VN/PRE.
> 
> Fixed as follows, bootstrapped on x86_64-unknown-linux-gnu, testing in
> progress.

Thanks, this resolves PR71893 for nvptx:

> 	PR tree-optimization/71893
> 	* tree-ssa-pre.c (create_component_ref_by_pieces_1): Compensate
> 	for sizetype cast added by array_ref_element_size.
> 	* tree-ssa-sccvn.c (copy_reference_ops_from_ref): Likewise.
> 
> Index: gcc/tree-ssa-pre.c
> ===================================================================
> *** gcc/tree-ssa-pre.c	(revision 238370)
> --- gcc/tree-ssa-pre.c	(working copy)
> *************** create_component_ref_by_pieces_1 (basic_
> *** 2576,2581 ****
> --- 2587,2595 ----
>   	      {
>   		genop3 = size_binop (EXACT_DIV_EXPR, genop3,
>   				     size_int (TYPE_ALIGN_UNIT (elmt_type)));
> + 		/* We may have a useless conversion added by
> + 		   array_ref_element_size via copy_reference_opts_from_ref.  */
> + 		STRIP_USELESS_TYPE_CONVERSION (genop3);
>   		genop3 = find_or_generate_expression (block, genop3, stmts);
>   		if (!genop3)
>   		  return NULL_TREE;
> Index: gcc/tree-ssa-sccvn.c
> ===================================================================
> *** gcc/tree-ssa-sccvn.c	(revision 238370)
> --- gcc/tree-ssa-sccvn.c	(working copy)
> *************** copy_reference_ops_from_ref (tree ref, v
> *** 810,815 ****
> --- 810,818 ----
>   	  /* Always record lower bounds and element size.  */
>   	  temp.op1 = array_ref_low_bound (ref);
>   	  temp.op2 = array_ref_element_size (ref);
> + 	  /* array_ref_element_size forces the result to sizetype
> + 	     even if that is the same as bitsizetype.  */
> + 	  STRIP_USELESS_TYPE_CONVERSION (temp.op2);
>   	  if (TREE_CODE (temp.op0) == INTEGER_CST
>   	      && TREE_CODE (temp.op1) == INTEGER_CST
>   	      && TREE_CODE (temp.op2) == INTEGER_CST)


Grüße
 Thomas

Attachment: signature.asc
Description: PGP signature


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