diff mbox

Fix typo in stmt_kills_ref_p_1

Message ID alpine.LNX.2.00.1305171445410.24881@zhemvz.fhfr.qr
State New
Headers show

Commit Message

Richard Biener May 17, 2013, 12:46 p.m. UTC
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.

Comments

Jakub Jelinek May 17, 2013, 12:53 p.m. UTC | #1
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
diff mbox

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