Patchwork Fix typo in stmt_kills_ref_p_1

login
register
mail settings
Submitter Richard Guenther
Date May 17, 2013, 12:46 p.m.
Message ID <alpine.LNX.2.00.1305171445410.24881@zhemvz.fhfr.qr>
Download mbox | patch
Permalink /patch/244630/
State New
Headers show

Comments

Richard Guenther - May 17, 2013, 12:46 p.m.
stmt_kills_ref_p_1 wants to compare MEM_REF offset but compares
the pointers instead (which are previously compared as equal).
This breaks my fix for PR57303.

Fixed thus, applied as obvious.

Richard.

2013-05-17  Richard Biener  <rguenther@suse.de>

	* tree-ssa-alias.c (stmt_kills_ref_p_1): Properly compare
	MEM_REF offsets.
Jakub Jelinek - May 17, 2013, 12:53 p.m.
On Fri, May 17, 2013 at 02:46:56PM +0200, Richard Biener wrote:
> 
> stmt_kills_ref_p_1 wants to compare MEM_REF offset but compares
> the pointers instead (which are previously compared as equal).
> This breaks my fix for PR57303.
> 
> Fixed thus, applied as obvious.
> 
> Richard.
> 
> 2013-05-17  Richard Biener  <rguenther@suse.de>
> 
> 	* tree-ssa-alias.c (stmt_kills_ref_p_1): Properly compare
> 	MEM_REF offsets.

Ugh, thanks.
As the 0th operand was equal, tree_int_cst_equal used to return always
1 and thus the if condition was never true.

> --- gcc/tree-ssa-alias.c	(revision 199004)
> +++ gcc/tree-ssa-alias.c	(working copy)
> @@ -2002,8 +2002,8 @@ stmt_kills_ref_p_1 (gimple stmt, ao_ref
>  	  if (TREE_CODE (base) == MEM_REF && TREE_CODE (ref->base) == MEM_REF
>  	      && TREE_OPERAND (base, 0) == TREE_OPERAND (ref->base, 0))
>  	    {
> -	      if (!tree_int_cst_equal (TREE_OPERAND (base, 0),
> -				       TREE_OPERAND (ref->base, 0)))
> +	      if (!tree_int_cst_equal (TREE_OPERAND (base, 1),
> +				       TREE_OPERAND (ref->base, 1)))
>  		{
>  		  double_int off1 = mem_ref_offset (base);
>  		  off1 = off1.lshift (BITS_PER_UNIT == 8

	Jakub

Patch

Index: gcc/tree-ssa-alias.c
===================================================================
--- gcc/tree-ssa-alias.c	(revision 199004)
+++ gcc/tree-ssa-alias.c	(working copy)
@@ -2002,8 +2002,8 @@  stmt_kills_ref_p_1 (gimple stmt, ao_ref
 	  if (TREE_CODE (base) == MEM_REF && TREE_CODE (ref->base) == MEM_REF
 	      && TREE_OPERAND (base, 0) == TREE_OPERAND (ref->base, 0))
 	    {
-	      if (!tree_int_cst_equal (TREE_OPERAND (base, 0),
-				       TREE_OPERAND (ref->base, 0)))
+	      if (!tree_int_cst_equal (TREE_OPERAND (base, 1),
+				       TREE_OPERAND (ref->base, 1)))
 		{
 		  double_int off1 = mem_ref_offset (base);
 		  off1 = off1.lshift (BITS_PER_UNIT == 8