rpms/gcc/devel gcc41-pr27218.patch, NONE, 1.1 gcc41-pr27236.patch, NONE, 1.1 gcc41-pr27285.patch, NONE, 1.1 .cvsignore, 1.146, 1.147 gcc41.spec, 1.53, 1.54 sources, 1.148, 1.149 gcc41-pr26769.patch, 1.1, NONE

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Tue Apr 25 10:16:40 UTC 2006


Author: jakub

Update of /cvs/dist/rpms/gcc/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv4396

Modified Files:
	.cvsignore gcc41.spec sources 
Added Files:
	gcc41-pr27218.patch gcc41-pr27236.patch gcc41-pr27285.patch 
Removed Files:
	gcc41-pr26769.patch 
Log Message:
4.1.0-11


gcc41-pr27218.patch:
 0 files changed

--- NEW FILE gcc41-pr27218.patch ---
2006-04-24  Andrew Pinski  <pinskia at gcc.gnu.org>
	Richard Guenther  <rguenther at suse.de>

	PR tree-optimization/27218
	* tree-inline.c (expand_call_inline): Strip useless type
	conversions for the return slot address.

	* g++.dg/tree-ssa/pr27218.C: New testcase.

--- gcc/testsuite/g++.dg/tree-ssa/pr27218.C	(revision 0)
+++ gcc/testsuite/g++.dg/tree-ssa/pr27218.C	(revision 113218)
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+struct Vector
+{
+    double _x, _y;
+};
+typedef Vector Point;
+Vector d;
+static inline Vector f(void)
+{
+  return d;
+}
+void add_duck (void)
+{
+    new Point (f());
+}
--- gcc/tree-inline.c	(revision 113217)
+++ gcc/tree-inline.c	(revision 113218)
@@ -2073,6 +2073,7 @@ expand_call_inline (basic_block bb, tree
       if (CALL_EXPR_RETURN_SLOT_OPT (t))
 	{
 	  return_slot_addr = build_fold_addr_expr (modify_dest);
+	  STRIP_USELESS_TYPE_CONVERSION (return_slot_addr);
 	  modify_dest = NULL;
 	}
     }

gcc41-pr27236.patch:
 0 files changed

--- NEW FILE gcc41-pr27236.patch ---
2006-04-24  Andrew Pinski  <pinskia at gcc.gnu.org>
	Richard Guenther  <rguenther at suse.de>

	PR tree-optimization/27236
	* tree-inline.c (copy_body_r): Make sure to copy
	TREE_THIS_VOLATILE flag.

	* gcc.dg/tree-ssa/pr27236.c: New testcase.

--- gcc/tree-inline.c	(revision 113220)
+++ gcc/tree-inline.c	(revision 113221)
@@ -590,6 +590,7 @@ copy_body_r (tree *tp, int *walk_subtree
 	  if (n)
 	    {
 	      tree new;
+	      tree old;
 	      /* If we happen to get an ADDR_EXPR in n->value, strip
 	         it manually here as we'll eventually get ADDR_EXPRs
 		 which lie about their types pointed to.  In this case
@@ -598,13 +599,17 @@ copy_body_r (tree *tp, int *walk_subtree
 	         does other useful transformations, try that first, though.  */
 	      tree type = TREE_TYPE (TREE_TYPE ((tree)n->value));
 	      new = unshare_expr ((tree)n->value);
+	      old = *tp;
 	      *tp = fold_indirect_ref_1 (type, new);
 	      if (! *tp)
 	        {
 		  if (TREE_CODE (new) == ADDR_EXPR)
 		    *tp = TREE_OPERAND (new, 0);
 	          else
-	            *tp = build1 (INDIRECT_REF, type, new);
+		    {
+	              *tp = build1 (INDIRECT_REF, type, new);
+		      TREE_THIS_VOLATILE (*tp) = TREE_THIS_VOLATILE (old);
+		    }
 		}
 	      *walk_subtrees = 0;
 	      return NULL;
--- gcc/testsuite/gcc.dg/tree-ssa/pr27236.c	(revision 0)
+++ gcc/testsuite/gcc.dg/tree-ssa/pr27236.c	(revision 113221)
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+
+static inline int inline_read(volatile int *mem)
+{
+        return *mem;
+}
+int foo_read(volatile int *mem)
+{
+        return inline_read(mem);
+}
+unsigned int foo(volatile int *mem)
+{
+        foo_read(mem);
+        return foo_read(mem);
+}
+
+/* { dg-final { scan-tree-dump-times "foo_read" 5 "optimized" } } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */

gcc41-pr27285.patch:
 pr27285.c |   46 ++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 46 insertions(+)

--- NEW FILE gcc41-pr27285.patch ---
2006-04-25  Jakub Jelinek  <jakub at redhat.com>

	PR tree-optimization/27285

	Backport from mainline:

	2006-03-28  Zdenek Dvorak  <dvorakz at suse.cz>

	PR tree-optimization/25985
	* tree-ssa-loop-niter.c (number_of_iterations_le,
	number_of_iterations_ne): Make comments more precise.
	(number_of_iterations_cond): Add only_exit argument.  Use the
	fact that signed variables do not overflow only when only_exit
	is true.
	(loop_only_exit_p): New.
	(number_of_iterations_exit): Pass result of loop_only_exit_p to
	number_of_iterations_cond.

	* gcc.c-torture/execute/pr27285.c: New test.

--- tree-ssa-loop-niter.c	(revision 112483)
+++ tree-ssa-loop-niter.c	(revision 112484)
@@ -129,9 +129,9 @@ inverse (tree x, tree mask)
 /* Determines number of iterations of loop whose ending condition
    is IV <> FINAL.  TYPE is the type of the iv.  The number of
    iterations is stored to NITER.  NEVER_INFINITE is true if
-   we know that the loop cannot be infinite (we derived this
-   earlier, and possibly set NITER->assumptions to make sure this
-   is the case.  */
+   we know that the exit must be taken eventually, i.e., that the IV
+   ever reaches the value FINAL (we derived this earlier, and possibly set
+   NITER->assumptions to make sure this is the case).  */
 
 static bool
 number_of_iterations_ne (tree type, affine_iv *iv, tree final,
@@ -492,9 +492,9 @@ number_of_iterations_lt (tree type, affi
 /* Determines number of iterations of loop whose ending condition
    is IV0 <= IV1.  TYPE is the type of the iv.  The number of
    iterations is stored to NITER.  NEVER_INFINITE is true if
-   we know that the loop cannot be infinite (we derived this
+   we know that this condition must eventually become false (we derived this
    earlier, and possibly set NITER->assumptions to make sure this
-   is the case.  */
+   is the case).  */
 
 static bool
 number_of_iterations_le (tree type, affine_iv *iv0, affine_iv *iv1,
@@ -538,6 +538,11 @@ number_of_iterations_le (tree type, affi
    is IV0, the right-hand side is IV1.  Both induction variables must have
    type TYPE, which must be an integer or pointer type.  The steps of the
    ivs must be constants (or NULL_TREE, which is interpreted as constant zero).
+
+   ONLY_EXIT is true if we are sure this is the only way the loop could be
+   exited (including possibly non-returning function calls, exceptions, etc.)
+   -- in this case we can use the information whether the control induction
+   variables can overflow or not in a more efficient way.
    
    The results (number of iterations and assumptions as described in
    comments at struct tree_niter_desc in tree-flow.h) are stored to NITER.
@@ -546,7 +551,8 @@ number_of_iterations_le (tree type, affi
 
 static bool
 number_of_iterations_cond (tree type, affine_iv *iv0, enum tree_code code,
-			   affine_iv *iv1, struct tree_niter_desc *niter)
+			   affine_iv *iv1, struct tree_niter_desc *niter,
+			   bool only_exit)
 {
   bool never_infinite;
 
@@ -572,13 +578,30 @@ number_of_iterations_cond (tree type, af
       code = swap_tree_comparison (code);
     }
 
+  if (!only_exit)
+    {
+      /* If this is not the only possible exit from the loop, the information
+	 that the induction variables cannot overflow as derived from
+	 signedness analysis cannot be relied upon.  We use them e.g. in the
+	 following way:  given loop for (i = 0; i <= n; i++), if i is
+	 signed, it cannot overflow, thus this loop is equivalent to
+	 for (i = 0; i < n + 1; i++);  however, if n == MAX, but the loop
+	 is exited in some other way before i overflows, this transformation
+	 is incorrect (the new loop exits immediately).  */
+      iv0->no_overflow = false;
+      iv1->no_overflow = false;
+    }
+
   if (POINTER_TYPE_P (type))
     {
       /* Comparison of pointers is undefined unless both iv0 and iv1 point
 	 to the same object.  If they do, the control variable cannot wrap
 	 (as wrap around the bounds of memory will never return a pointer
 	 that would be guaranteed to point to the same object, even if we
-	 avoid undefined behavior by casting to size_t and back).  */
+	 avoid undefined behavior by casting to size_t and back).  The
+	 restrictions on pointer arithmetics and comparisons of pointers
+	 ensure that using the no-overflow assumptions is correct in this
+	 case even if ONLY_EXIT is false.  */
       iv0->no_overflow = true;
       iv1->no_overflow = true;
     }
@@ -963,6 +986,37 @@ simplify_using_outer_evolutions (struct 
   return expr;
 }
 
+/* Returns true if EXIT is the only possible exit from LOOP.  */
+
+static bool
+loop_only_exit_p (struct loop *loop, edge exit)
+{
+  basic_block *body;
+  block_stmt_iterator bsi;
+  unsigned i;
+  tree call;
+
+  if (exit != loop->single_exit)
+    return false;
+
+  body = get_loop_body (loop);
+  for (i = 0; i < loop->num_nodes; i++)
+    {
+      for (bsi = bsi_start (body[0]); !bsi_end_p (bsi); bsi_next (&bsi))
+	{
+	  call = get_call_expr_in (bsi_stmt (bsi));
+	  if (call && TREE_SIDE_EFFECTS (call))
+	    {
+	      free (body);
+	      return false;
+	    }
+	}
+    }
+
+  free (body);
+  return true;
+}
+
 /* Stores description of number of iterations of LOOP derived from
    EXIT (an exit edge of the LOOP) in NITER.  Returns true if some
    useful information could be derived (and fields of NITER has
@@ -1023,7 +1077,8 @@ number_of_iterations_exit (struct loop *
 
   iv0.base = expand_simple_operations (iv0.base);
   iv1.base = expand_simple_operations (iv1.base);
-  if (!number_of_iterations_cond (type, &iv0, code, &iv1, niter))
+  if (!number_of_iterations_cond (type, &iv0, code, &iv1, niter,
+				  loop_only_exit_p (loop, exit)))
     return false;
 
   if (optimize >= 3)
--- gcc/testsuite/gcc.c-torture/execute/pr27285.c	2006-04-19 19:21:31.748476000 +0200
+++ gcc/testsuite/gcc.c-torture/execute/pr27285.c	2006-04-24 17:00:35.000000000 +0200
@@ -0,0 +1,46 @@
+/* PR tree-optimization/27285 */
+
+extern void abort (void);
+
+struct S { unsigned char a, b, c, d[16]; };
+
+void __attribute__ ((noinline))
+foo (struct S *x, struct S *y)
+{
+  int a, b;
+  unsigned char c, *d, *e;
+
+  b = x->b;
+  d = x->d;
+  e = y->d;
+  a = 0;
+  while (b)
+    {
+      if (b >= 8)
+	{
+	  c = 0xff;
+	  b -= 8;
+	}
+      else
+	{
+	  c = 0xff << (8 - b);
+	  b = 0;
+	}
+
+      e[a] = d[a] & c;
+      a++;
+    }
+}
+
+int
+main (void)
+{
+  struct S x = { 0, 25, 0, { 0xaa, 0xbb, 0xcc, 0xdd }};
+  struct S y = { 0, 0, 0, { 0 }};
+
+  foo (&x, &y);
+  if (x.d[0] != y.d[0] || x.d[1] != y.d[1]
+      || x.d[2] != y.d[2] || (x.d[3] & 0x80) != y.d[3])
+    abort ();
+   return 0;
+}


Index: .cvsignore
===================================================================
RCS file: /cvs/dist/rpms/gcc/devel/.cvsignore,v
retrieving revision 1.146
retrieving revision 1.147
diff -u -r1.146 -r1.147
--- .cvsignore	21 Apr 2006 20:45:38 -0000	1.146
+++ .cvsignore	25 Apr 2006 10:16:22 -0000	1.147
@@ -1 +1 @@
-gcc-4.1.0-20060421.tar.bz2
+gcc-4.1.0-20060425.tar.bz2


Index: gcc41.spec
===================================================================
RCS file: /cvs/dist/rpms/gcc/devel/gcc41.spec,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -r1.53 -r1.54
--- gcc41.spec	21 Apr 2006 20:45:38 -0000	1.53
+++ gcc41.spec	25 Apr 2006 10:16:22 -0000	1.54
@@ -1,6 +1,6 @@
-%define DATE 20060421
+%define DATE 20060425
 %define gcc_version 4.1.0
-%define gcc_release 10
+%define gcc_release 11
 %define _unpackaged_files_terminate_build 0
 %define multilib_64_archs sparc64 ppc64 s390x x86_64
 %ifarch %{ix86} x86_64 ia64
@@ -115,7 +115,7 @@
 Patch18: gcc41-objc-rh185398.patch
 Patch19: gcc41-pr22375.patch
 Patch20: gcc41-tests.patch
-Patch21: gcc41-pr26769.patch
+Patch21: gcc41-pr27218.patch
 Patch22: gcc41-ppc64-ldouble-stdarg.patch
 Patch23: gcc41-pr25874.patch
 Patch24: gcc41-pr25989.patch
@@ -127,6 +127,8 @@
 Patch30: gcc41-rh188944.patch
 Patch31: gcc41-rh137200.patch
 Patch32: gcc41-rh187450.patch
+Patch33: gcc41-pr27236.patch
+Patch34: gcc41-pr27285.patch
 
 %define _gnu %{nil}
 %ifarch sparc
@@ -426,7 +428,7 @@
 %patch18 -p0 -b .objc-rh185398~
 %patch19 -p0 -b .pr22375~
 %patch20 -p0 -b .tests~
-%patch21 -p0 -b .pr26769~
+%patch21 -p0 -b .pr27218~
 %patch22 -p0 -b .ppc64-ldouble-stdarg~
 %patch23 -p0 -b .pr25874~
 %patch24 -p0 -b .pr25989~
@@ -438,6 +440,8 @@
 %patch30 -p0 -b .rh188944~
 %patch31 -p0 -b .rh137200~
 %patch32 -p0 -b .rh187450~
+%patch33 -p0 -b .pr27236~
+%patch34 -p0 -b .pr27285~
 
 sed -i -e 's/4\.1\.1/4.1.0/' gcc/BASE-VER gcc/version.c
 sed -i -e 's/" (Red Hat[^)]*)"/" (Red Hat %{version}-%{gcc_release})"/' gcc/version.c
@@ -1462,6 +1466,19 @@
 %doc rpm.doc/changelogs/libmudflap/ChangeLog*
 
 %changelog
+* Tue Apr 25 2006 Jakub Jelinek <jakub at redhat.com> 4.1.0-11
+- update from gcc-4_1-branch (-r113149:113242)
+  - PRs c/25875, c/26774, fortran/18803, fortran/25597, fortran/25669,
+	fortran/26787, fortran/26822, fortran/26834, fortran/27089,
+	fortran/27113, fortran/27122, fortran/27124, target/21283,
+	target/26961
+- fix number of iterations computation (Zdenek Dvorak, #189376,
+  PR tree-optimization/27285)
+- fix handling of volatile in the inliner (Andrew Pinski, Richard Guenther,
+  PR tree-optimization/27236)
+- strip useless type conversions in the inliner (Andrew Pinski,
+  Richard Guenther, PR tree-optimization/27218)
+
 * Fri Apr 21 2006 Jakub Jelinek <jakub at redhat.com> 4.1.0-10
 - update from gcc-4_1-branch (-r113110:113149)
   - PRs libgcj/21941, libgcj/27170, libgcj/27231, libgfortran/27138,


Index: sources
===================================================================
RCS file: /cvs/dist/rpms/gcc/devel/sources,v
retrieving revision 1.148
retrieving revision 1.149
diff -u -r1.148 -r1.149
--- sources	21 Apr 2006 20:45:38 -0000	1.148
+++ sources	25 Apr 2006 10:16:22 -0000	1.149
@@ -1 +1 @@
-19e1f84413aad25f18300a7dfe37c4b8  gcc-4.1.0-20060421.tar.bz2
+128037919d9a93d4e2270b4cf8b8b862  gcc-4.1.0-20060425.tar.bz2


--- gcc41-pr26769.patch DELETED ---




More information about the fedora-cvs-commits mailing list