public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PTR-PLUS] Merge the mainline into the branch (and fix the last regression  on i686-linux-gnu)
@ 2007-05-14 22:00 Andrew_Pinski
  0 siblings, 0 replies; only message in thread
From: Andrew_Pinski @ 2007-05-14 22:00 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 862 bytes --]

Hi,
  I merged from the mainline (revision 124657) into the branch after a 
bootstrap/test.  I also fixed the last regression while I was at it, 
split_constant_offset needed to be taught about POINTER_PLUS_EXPR which I 
must had missed before.  Since tree-data-ref.c got a rewrite I was able to 
spot this case easier.  I also had to fix the builtin memchr's code for 
the POINTER_PLUS_EXPR change.

Committed after a bootstrap/test on i686-linux-gnu with no regressions.

Thanks,
Andrew Pinski

ChangeLog:

        * tree-data-ref.c (split_constant_offset): Handle 
POINTER_PLUS_EXPR
        exactly the same as PLUS_EXPR/MINUS_EXPR except for the offset
        needs to be calcuated using PLUS_EXPR instead of
        POINTER_PLUS_EXPR.
        * builtins.c (fold_builtin_memchr): Use POINTER_PLUS_EXPR
        instead of PLUS_EXPR for adding to a pointer.


[-- Attachment #2: fixlastregression.diff.txt --]
[-- Type: text/plain, Size: 1603 bytes --]

--- ../../../local/gcc/gcc/tree-data-ref.c	2007-05-13 16:34:05.000000000 -0700
+++ ./tree-data-ref.c	2007-05-13 16:56:54.000000000 -0700
@@ -495,25 +495,30 @@ split_constant_offset (tree exp, tree *v
   tree type = TREE_TYPE (exp), otype;
   tree var0, var1;
   tree off0, off1;
+  enum tree_code code;
 
   *var = exp;
   STRIP_NOPS (exp);
   otype = TREE_TYPE (exp);
+  code = TREE_CODE (exp);
 
-  switch (TREE_CODE (exp))
+  switch (code)
     {
     case INTEGER_CST:
       *var = build_int_cst (type, 0);
       *off = fold_convert (ssizetype, exp);
       return;
 
+    case POINTER_PLUS_EXPR:
+      code = PLUS_EXPR;
+      /* FALL THROUGH */
     case PLUS_EXPR:
     case MINUS_EXPR:
       split_constant_offset (TREE_OPERAND (exp, 0), &var0, &off0);
       split_constant_offset (TREE_OPERAND (exp, 1), &var1, &off1);
       *var = fold_convert (type, fold_build2 (TREE_CODE (exp), otype, 
 					      var0, var1));
-      *off = size_binop (TREE_CODE (exp), off0, off1);
+      *off = size_binop (code, off0, off1);
       return;
 
     case MULT_EXPR:
--- ../../../local/gcc/gcc/builtins.c	2007-05-13 16:34:05.000000000 -0700
+++ ./builtins.c	2007-05-14 10:34:15.000000000 -0700
@@ -8716,8 +8714,8 @@ fold_builtin_memchr (tree arg1, tree arg
 	  if (r == NULL)
 	    return build_int_cst (TREE_TYPE (arg1), 0);
 
-	  tem = fold_build2 (PLUS_EXPR, TREE_TYPE (arg1), arg1,
-			     build_int_cst (TREE_TYPE (arg1), r - p1));
+	  tem = fold_build2 (POINTER_PLUS_EXPR, TREE_TYPE (arg1), arg1,
+			     size_int (r - p1));
 	  return fold_convert (type, tem);
 	}
       return NULL_TREE;


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-05-14 22:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-05-14 22:00 [PTR-PLUS] Merge the mainline into the branch (and fix the last regression on i686-linux-gnu) Andrew_Pinski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).