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: Fix strrchr simplification


> 
> Hi Honza,
> On Wed, 5 Nov 2003, Jan Hubicka wrote:
> > 2003-11-05  Jan Hubicka  <jh@suse.cz>
> >
> > 	* builtins.c (simplify_builtin_strrchr, simplify_builtin_strpbrk): Add
> > 	missing casts.
> >
> > OK?
> 
> Ok.  Please remember to quote the target tripples that you tested your
> patches on and whether there were any new regressions in future.

Actually I did tested it only in heavilly modified tree-ssa tree.  In
meantime it bootstrapped/regtested i386 on mainline, but by adding
sanity check in fold_binary_nondestructive, I found more cu&paste
occurences in fodling code.

The patch testing is again in progress on i386-unknown-linux.  OK
assuming it passes?
It fixes some of long standing string-* failures on tree-ssa branch.

Honza

2003-11-05  Jan Hubicka  <jh@suse.cz>
	* builtins.c (expand_builtin_strstr, expand_builtin_strchr,
	expand_builtin_strrchr, expand_builtin_strpbrk,
	simplify_builtin_strstr, simplify_builtin_strrchr,
	simplify_builtin_strpbrk): Add missing casts.
Index: builtins.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/builtins.c,v
retrieving revision 1.152.2.39
diff -c -3 -p -r1.152.2.39 builtins.c
*** builtins.c	18 Oct 2003 23:59:34 -0000	1.152.2.39
--- builtins.c	5 Nov 2003 15:04:00 -0000
*************** expand_builtin_strstr (tree arglist, rtx
*** 2278,2284 ****
  
  	  /* Return an offset into the constant string argument.  */
  	  return expand_expr (fold (build (PLUS_EXPR, TREE_TYPE (s1),
! 					   s1, ssize_int (r - p1))),
  			      target, mode, EXPAND_NORMAL);
  	}
  
--- 2278,2285 ----
  
  	  /* Return an offset into the constant string argument.  */
  	  return expand_expr (fold (build (PLUS_EXPR, TREE_TYPE (s1),
! 					   s1, convert (TREE_TYPE (s1),
! 							ssize_int (r - p1)))),
  			      target, mode, EXPAND_NORMAL);
  	}
  
*************** expand_builtin_strchr (tree arglist, rtx
*** 2335,2341 ****
  
  	  /* Return an offset into the constant string argument.  */
  	  return expand_expr (fold (build (PLUS_EXPR, TREE_TYPE (s1),
! 					   s1, ssize_int (r - p1))),
  			      target, mode, EXPAND_NORMAL);
  	}
  
--- 2336,2343 ----
  
  	  /* Return an offset into the constant string argument.  */
  	  return expand_expr (fold (build (PLUS_EXPR, TREE_TYPE (s1),
! 					   s1, convert (TREE_TYPE (s1),
! 							ssize_int (r - p1)))),
  			      target, mode, EXPAND_NORMAL);
  	}
  
*************** expand_builtin_strrchr (tree arglist, rt
*** 2379,2385 ****
  
  	  /* Return an offset into the constant string argument.  */
  	  return expand_expr (fold (build (PLUS_EXPR, TREE_TYPE (s1),
! 					   s1, ssize_int (r - p1))),
  			      target, mode, EXPAND_NORMAL);
  	}
  
--- 2381,2388 ----
  
  	  /* Return an offset into the constant string argument.  */
  	  return expand_expr (fold (build (PLUS_EXPR, TREE_TYPE (s1),
! 					   s1, convert (TREE_TYPE (s1),
! 							ssize_int (r - p1)))),
  			      target, mode, EXPAND_NORMAL);
  	}
  
*************** expand_builtin_strpbrk (tree arglist, rt
*** 2425,2431 ****
  
  	  /* Return an offset into the constant string argument.  */
  	  return expand_expr (fold (build (PLUS_EXPR, TREE_TYPE (s1),
! 					   s1, ssize_int (r - p1))),
  			      target, mode, EXPAND_NORMAL);
  	}
  
--- 2428,2435 ----
  
  	  /* Return an offset into the constant string argument.  */
  	  return expand_expr (fold (build (PLUS_EXPR, TREE_TYPE (s1),
! 					   s1, convert (TREE_TYPE (s1),
! 							ssize_int (r - p1)))),
  			      target, mode, EXPAND_NORMAL);
  	}
  
*************** simplify_builtin_strstr (tree arglist)
*** 7165,7171 ****
  	    return integer_zero_node;
  	  else
  	    return fold (build (PLUS_EXPR, TREE_TYPE (s1),
! 				s1, ssize_int (r - p1)));
  	}
  
        if (p2[0] == '\0')
--- 7169,7176 ----
  	    return integer_zero_node;
  	  else
  	    return fold (build (PLUS_EXPR, TREE_TYPE (s1),
! 				s1, convert (TREE_TYPE (s1),
! 					     ssize_int (r - p1))));
  	}
  
        if (p2[0] == '\0')
*************** simplify_builtin_strchr (tree arglist)
*** 7232,7238 ****
  
  	  /* Return an offset into the constant string argument.  */
  	  return fold (build (PLUS_EXPR, TREE_TYPE (s1),
! 			      s1, ssize_int (r - p1)));
  	}
  
        /* FIXME: Should use here strchrM optab so that ports can optimize
--- 7237,7244 ----
  
  	  /* Return an offset into the constant string argument.  */
  	  return fold (build (PLUS_EXPR, TREE_TYPE (s1),
! 			      s1, convert (TREE_TYPE (s1),
! 					   ssize_int (r - p1))));
  	}
  
        /* FIXME: Should use here strchrM optab so that ports can optimize
*************** simplify_builtin_strrchr (tree arglist)
*** 7288,7294 ****
  
  	  /* Return an offset into the constant string argument.  */
  	  return fold (build (PLUS_EXPR, TREE_TYPE (s1),
! 			      s1, ssize_int (r - p1)));
  	}
  
        if (! integer_zerop (s2))
--- 7294,7301 ----
  
  	  /* Return an offset into the constant string argument.  */
  	  return fold (build (PLUS_EXPR, TREE_TYPE (s1),
! 			      s1, convert (TREE_TYPE (s1),
! 					   ssize_int (r - p1))));
  	}
  
        if (! integer_zerop (s2))
*************** simplify_builtin_strpbrk (tree arglist)
*** 7345,7351 ****
  
  	  /* Return an offset into the constant string argument.  */
  	  return fold (build (PLUS_EXPR, TREE_TYPE (s1),
! 			      s1, ssize_int (r - p1)));
  	}
  
        if (p2[0] == '\0')
--- 7352,7359 ----
  
  	  /* Return an offset into the constant string argument.  */
  	  return fold (build (PLUS_EXPR, TREE_TYPE (s1),
! 			      s1, convert (TREE_TYPE (s1),
! 					   ssize_int (r - p1))));
  	}
  
        if (p2[0] == '\0')


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