rpms/gcc/devel gcc4-ia64-profile.patch, NONE, 1.1 gcc4-pr21983.patch, NONE, 1.1 gcc4-pr22362.patch, NONE, 1.1 gcc4-pr23056.patch, NONE, 1.1 gcc4-pr23075.patch, NONE, 1.1 gcc4-pr23098.patch, NONE, 1.1

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Tue Sep 6 12:00:35 UTC 2005


Author: jakub

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

Added Files:
	gcc4-ia64-profile.patch gcc4-pr21983.patch gcc4-pr22362.patch 
	gcc4-pr23056.patch gcc4-pr23075.patch gcc4-pr23098.patch 
Log Message:
4.0.1-13


gcc4-ia64-profile.patch:
 ia64-protos.h |    1 +
 ia64.c        |   34 ++++++++++++++++++++++++++++++++++
 ia64.h        |   23 +++++------------------
 3 files changed, 40 insertions(+), 18 deletions(-)

--- NEW FILE gcc4-ia64-profile.patch ---
2005-06-08  Richard Henderson  <rth at redhat.com>

	* config/ia64/ia64.h (NO_PROFILE_COUNTERS): New.
	* config/ia64/ia64.c (ia64_output_function_profiler): Honor it.
	Emit out3 load right after alloc.

	* config/ia64/ia64.h (FUNCTION_PROFILER): Move implementation ...
	* config/ia64/ia64.c (ia64_output_function_profiler): ... here; add
	unwind markup.
	* config/ia64/ia64-protos.h (ia64_output_function_profiler): Declare.

--- gcc/config/ia64/ia64.c	8 Jun 2005 07:26:58 -0000	1.372
+++ gcc/config/ia64/ia64.c	8 Jun 2005 21:29:36 -0000	1.374
@@ -8551,4 +8551,38 @@ ia64_vector_mode_supported_p (enum machi
     }
 }
 
+void
+ia64_output_function_profiler (FILE *file, int labelno)
+{
+  if (TARGET_GNU_AS)
+    fputs ("\t.prologue 4, r40\n", file);
+  else
+    fputs ("\t.prologue\n\t.save ar.pfs, r40\n", file);
+  fputs ("\talloc out0 = ar.pfs, 8, 0, 4, 0\n", file);
+
+  if (NO_PROFILE_COUNTERS)
+    fputs ("\tmov out3 = r0\n\t;;\n", file);
+  else
+    {
+      char buf[20];
+      ASM_GENERATE_INTERNAL_LABEL (buf, "LP", labelno);
+
+      if (TARGET_AUTO_PIC)
+	fputs ("\tmovl out3 = @gprel(", file);
+      else
+	fputs ("\taddl out3 = @ltoff(", file);
+      assemble_name (file, buf);
+      if (TARGET_AUTO_PIC)
+	fputs (")\n\t;;\n", file);
+      else
+	fputs ("), r1\n\t;;\n", file);
+    }
+
+  fputs ("\t.save rp, r42\n", file);
+  fputs ("\tmov out2 = b0\n", file);
+  fputs ("\t.body\n", file);
+  fputs ("\tmov out1 = r1\n", file);
+  fputs ("\tbr.call.sptk.many b0 = _mcount\n\t;;\n", file);
+}
+
 #include "gt-ia64.h"
--- gcc/config/ia64/ia64.h	8 Jun 2005 05:05:28 -0000	1.201
+++ gcc/config/ia64/ia64.h	8 Jun 2005 21:29:36 -0000	1.203
@@ -1265,24 +1265,11 @@ do {									\
    call the profiling subroutine `mcount'.  */
 
 #undef FUNCTION_PROFILER
-#define FUNCTION_PROFILER(FILE, LABELNO)				\
-do {									\
-  char buf[20];								\
-  ASM_GENERATE_INTERNAL_LABEL (buf, "LP", LABELNO);			\
-  fputs ("\talloc out0 = ar.pfs, 8, 0, 4, 0\n", FILE);			\
-  if (TARGET_AUTO_PIC)							\
-    fputs ("\tmovl out3 = @gprel(", FILE);				\
-  else									\
-    fputs ("\taddl out3 = @ltoff(", FILE);				\
-  assemble_name (FILE, buf);						\
-  if (TARGET_AUTO_PIC)							\
-    fputs (");;\n", FILE);						\
-  else									\
-    fputs ("), r1;;\n", FILE);						\
-  fputs ("\tmov out1 = r1\n", FILE);					\
-  fputs ("\tmov out2 = b0\n", FILE);					\
-  fputs ("\tbr.call.sptk.many b0 = _mcount;;\n", FILE);			\
-} while (0)
+#define FUNCTION_PROFILER(FILE, LABELNO) \
+  ia64_output_function_profiler(FILE, LABELNO)
+
+/* Neither hpux nor linux use profile counters.  */
+#define NO_PROFILE_COUNTERS 1
 
 /* Trampolines for Nested Functions.  */
 
--- gcc/config/ia64/ia64-protos.h	8 Jun 2005 05:05:23 -0000	1.73
+++ gcc/config/ia64/ia64-protos.h	8 Jun 2005 19:23:04 -0000	1.74
@@ -113,3 +113,4 @@ extern enum direction ia64_hpux_function
 #endif /* ARGS_SIZE_RTX */
 
 extern void ia64_hpux_handle_builtin_pragma (struct cpp_reader *);
+extern void ia64_output_function_profiler (FILE *, int);

gcc4-pr21983.patch:
 cp/class.c                      |   11 +++++------
 testsuite/g++.dg/warn/pr21983.C |    7 +++++++
 2 files changed, 12 insertions(+), 6 deletions(-)

--- NEW FILE gcc4-pr21983.patch ---
2005-09-05  Jakub Jelinek  <jakub at redhat.com>

	PR c++/21983
	* class.c (find_final_overrider): Move diagnostic about no unique final
	overrider to...
	(update_vtable_entry_for_fn): ... here.

--- gcc/cp/class.c.jj	2005-08-16 16:24:16.000000000 +0200
+++ gcc/cp/class.c	2005-09-05 17:03:08.000000000 +0200
@@ -1906,11 +1906,7 @@ find_final_overrider (tree derived, tree
 
   /* If there was no winner, issue an error message.  */
   if (!ffod.candidates || TREE_CHAIN (ffod.candidates))
-    {
-      error ("no unique final overrider for %qD in %qT", fn,
-	     BINFO_TYPE (derived));
-      return error_mark_node;
-    }
+    return error_mark_node;
 
   return ffod.candidates;
 }
@@ -1970,7 +1966,10 @@ update_vtable_entry_for_fn (tree t, tree
   /* Find the final overrider.  */
   overrider = find_final_overrider (TYPE_BINFO (t), b, target_fn);
   if (overrider == error_mark_node)
-    return;
+    {
+      error ("no unique final overrider for %qD in %qT", target_fn, t);
+      return;
+    }
   overrider_target = overrider_fn = TREE_PURPOSE (overrider);
 
   /* Check for adjusting covariant return types.  */
--- gcc/testsuite/g++.dg/warn/pr21983.C.jj	2005-09-05 17:06:42.000000000 +0200
+++ gcc/testsuite/g++.dg/warn/pr21983.C	2005-09-05 17:08:06.000000000 +0200
@@ -0,0 +1,7 @@
+// PR c++/21983
+// { dg-do compile }
+
+struct B { virtual void foo () = 0; };
+struct D1 : public virtual B { virtual void foo () {} };
+struct D2 : public virtual B { virtual void foo () {} };
+struct D : public D1, public D2 { };	// { dg-warning "no unique final overrider" }

gcc4-pr22362.patch:
 config/i386/i386.c                  |   25 +++++++++++++++++++++----
 testsuite/gcc.target/i386/pr22362.c |   25 +++++++++++++++++++++++++
 2 files changed, 46 insertions(+), 4 deletions(-)

--- NEW FILE gcc4-pr22362.patch ---
2005-09-05  Jakub Jelinek  <jakub at redhat.com>

	PR target/22362
	* config/i386/i386.c (ix86_function_regparm): Make sure automatic regparm
	for internal functions doesn't use registers used by global registers
	variables.  Use fewer register parameters if there are global register
	variables.

--- gcc/config/i386/i386.c.jj	2005-09-02 09:01:21.000000000 +0200
+++ gcc/config/i386/i386.c	2005-09-05 15:07:22.000000000 +0200
@@ -2148,12 +2148,29 @@ ix86_function_regparm (tree type, tree d
 	  struct cgraph_local_info *i = cgraph_local_info (decl);
 	  if (i && i->local)
 	    {
+	      int local_regparm, globals = 0, regno;
+
+	      /* Make sure no regparm register is taken by a global register
+		 variable.  */
+	      for (local_regparm = 0; local_regparm < 3; local_regparm++)
+		if (global_regs[local_regparm])
+		  break;
 	      /* We can't use regparm(3) for nested functions as these use
 		 static chain pointer in third argument.  */
-	      if (DECL_CONTEXT (decl) && !DECL_NO_STATIC_CHAIN (decl))
-		regparm = 2;
-	      else
-		regparm = 3;
+	      if (local_regparm == 3
+		  && DECL_CONTEXT (decl) && !DECL_NO_STATIC_CHAIN (decl))
+		local_regparm = 2;
+	      /* Each global register variable increases register preassure,
+		 so the more global reg vars there are, the smaller regparm
+		 optimization use, unless requested by the user explicitly.  */
+	      for (regno = 0; regno < 6; regno++)
+		if (global_regs[regno])
+		  globals++;
+	      local_regparm
+		= globals < local_regparm ? local_regparm - globals : 0;
+
+	      if (local_regparm > regparm)
+		regparm = local_regparm;
 	    }
 	}
     }
--- gcc/testsuite/gcc.target/i386/pr22362.c.jj	2005-09-05 15:10:09.000000000 +0200
+++ gcc/testsuite/gcc.target/i386/pr22362.c	2005-09-05 15:10:19.000000000 +0200
@@ -0,0 +1,25 @@
+/* PR target/22362 */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+/* { dg-require-effective-target ilp32 } */
+
+register unsigned int reg0 __asm__ ("esi");
+register unsigned int reg1 __asm__ ("edi");
+register unsigned int reg2 __asm__ ("ebx");
+
+static unsigned int
+__attribute__((noinline))
+foo (unsigned long *x, void *y, void *z)
+{
+  int i;
+
+  for (i = 5; i > 0; i--)
+    x[i] = (unsigned long) foo ((unsigned long *) x[i], y, z);
+  return 0;
+}
+
+unsigned int
+bar (void)
+{
+  return foo (0, 0, 0);
+}

gcc4-pr23056.patch:
 cp/typeck.c                    |   47 +++++++++++++++++++++++++++++------------
 testsuite/g++.dg/opt/pr23056.C |    9 +++++++
 2 files changed, 43 insertions(+), 13 deletions(-)

--- NEW FILE gcc4-pr23056.patch ---
2005-09-06  Jakub Jelinek  <jakub at redhat.com>

	PR c++/23056
	* typeck.c (ignore_overflows): New helper function.
	(build_static_cast_1): Use it.

	* g++.dg/opt/pr23056.C: New test.

--- gcc/cp/typeck.c.jj	2005-09-05 11:44:02.000000000 +0200
+++ gcc/cp/typeck.c	2005-09-05 14:56:40.000000000 +0200
@@ -4526,6 +4526,37 @@ convert_ptrmem (tree type, tree expr, bo
 			     allow_inverse_p, c_cast_p);
 }
 
+/* If EXPR is an INTEGER_CST and ORIG is an arithmetic constant, return
+   a version of EXPR that has TREE_OVERFLOW and/or TREE_CONSTANT_OVERFLOW
+   set iff they are set in ORIG.  Otherwise, return EXPR unchanged.  */
+
+static tree
+ignore_overflows (tree expr, tree orig)
+{
+  if (TREE_CODE (expr) == INTEGER_CST
+      && CONSTANT_CLASS_P (orig)
+      && TREE_CODE (orig) != STRING_CST
+      && (TREE_OVERFLOW (expr) != TREE_OVERFLOW (orig)
+	  || TREE_CONSTANT_OVERFLOW (expr)
+	     != TREE_CONSTANT_OVERFLOW (orig)))
+    {
+      if (!TREE_OVERFLOW (orig) && !TREE_CONSTANT_OVERFLOW (orig))
+	/* Ensure constant sharing.  */
+	expr = build_int_cst_wide (TREE_TYPE (expr),
+				   TREE_INT_CST_LOW (expr),
+				   TREE_INT_CST_HIGH (expr));
+      else
+	{
+	  /* Avoid clobbering a shared constant.  */
+	  expr = copy_node (expr);
+	  TREE_OVERFLOW (expr) = TREE_OVERFLOW (orig);
+	  TREE_CONSTANT_OVERFLOW (expr)
+	    = TREE_CONSTANT_OVERFLOW (orig);
+	}
+    }
+  return expr;
+}
+
 /* Perform a static_cast from EXPR to TYPE.  When C_CAST_P is true,
    this static_cast is being attempted as one of the possible casts
    allowed by a C-style cast.  (In that case, accessibility of base
@@ -4629,13 +4659,8 @@ build_static_cast_1 (tree type, tree exp
       result = convert_from_reference (result);
 
       /* Ignore any integer overflow caused by the cast.  */
-      if (TREE_CODE (result) == INTEGER_CST
-	  && CONSTANT_CLASS_P (orig))
-	{
-	  TREE_OVERFLOW (result) = TREE_OVERFLOW (orig);
-	  TREE_CONSTANT_OVERFLOW (result)
-	    = TREE_CONSTANT_OVERFLOW (orig);
-	}
+      result = ignore_overflows (result, orig);
+
       /* [expr.static.cast]
 
 	 If T is a reference type, the result is an lvalue; otherwise,
@@ -4678,12 +4703,7 @@ build_static_cast_1 (tree type, tree exp
       expr = ocp_convert (type, expr, CONV_C_CAST, LOOKUP_NORMAL);
 
       /* Ignore any integer overflow caused by the cast.  */
-      if (TREE_CODE (expr) == INTEGER_CST
-	  && CONSTANT_CLASS_P (orig))
-	{
-	  TREE_OVERFLOW (expr) = TREE_OVERFLOW (orig);
-	  TREE_CONSTANT_OVERFLOW (expr) = TREE_CONSTANT_OVERFLOW (orig);
-	}
+      expr = ignore_overflows (expr, orig);
       return expr;
     }
 
--- gcc/testsuite/g++.dg/opt/pr23056.C.jj	2005-09-05 12:57:04.000000000 +0200
+++ gcc/testsuite/g++.dg/opt/pr23056.C	2005-09-05 12:56:21.000000000 +0200
@@ -0,0 +1,9 @@
+// PR c++/23056
+// { dg-do compile }
+
+template <bool T> struct S { virtual ~S(); };
+void foo ()
+{
+  static_cast<bool>("Foo");
+}
+S<true> a;

gcc4-pr23075.patch:
 c-typeck.c                      |   14 ++++++++++----
 cp/cp-tree.h                    |    2 +-
 cp/semantics.c                  |    4 +++-
 cp/typeck.c                     |   12 ++++++++++--
 testsuite/g++.dg/warn/pr23075.C |   14 ++++++++++++++
 testsuite/gcc.dg/pr23075.c      |   14 ++++++++++++++
 tree-cfg.c                      |    3 ++-
 7 files changed, 54 insertions(+), 9 deletions(-)

--- NEW FILE gcc4-pr23075.patch ---
2005-09-05  Jakub Jelinek  <jakub at redhat.com>

	PR c/23075
	* c-typeck.c (c_finish_return): Set TREE_NO_WARNING on RETURN_EXPR
	if "return with no value, in function returning non-void" warning
	has been issued.
  	* tree-cfg.c (execute_warn_function_return): Don't look at
	RETURN_EXPRs with TREE_NO_WARNING set.

	* typeck.c (check_return_expr): Add no_warning argument.  Set
	*no_warning to true if "return-statement with no value, in function
	returning" warning has been issued.
	* cp-tree.h (check_return_expr): Adjust prototype.
	* semantics.c (finish_return_stmt): Set TREE_NO_WARNING if
	check_return_expr set *no_warning to true.

	* gcc.dg/pr23075.c: New test.
	* g++.dg/warn/pr23075.C: New test.

--- gcc/c-typeck.c.jj	2005-08-27 10:12:41.000000000 +0200
+++ gcc/c-typeck.c	2005-09-05 11:45:49.000000000 +0200
@@ -6702,7 +6702,8 @@ c_finish_goto_ptr (tree expr)
 tree
 c_finish_return (tree retval)
 {
-  tree valtype = TREE_TYPE (TREE_TYPE (current_function_decl));
+  tree valtype = TREE_TYPE (TREE_TYPE (current_function_decl)), ret_stmt;
+  bool no_warning = false;
 
   if (TREE_THIS_VOLATILE (current_function_decl))
     warning (0, "function declared %<noreturn%> has a %<return%> statement");
@@ -6712,8 +6713,11 @@ c_finish_return (tree retval)
       current_function_returns_null = 1;
       if ((warn_return_type || flag_isoc99)
 	  && valtype != 0 && TREE_CODE (valtype) != VOID_TYPE)
-	pedwarn_c99 ("%<return%> with no value, in "
-		     "function returning non-void");
+	{
+	  pedwarn_c99 ("%<return%> with no value, in "
+		       "function returning non-void");
+	  no_warning = true;
+	}
     }
   else if (valtype == 0 || TREE_CODE (valtype) == VOID_TYPE)
     {
@@ -6789,7 +6793,9 @@ c_finish_return (tree retval)
       retval = build2 (MODIFY_EXPR, TREE_TYPE (res), res, t);
     }
 
-  return add_stmt (build_stmt (RETURN_EXPR, retval));
+  ret_stmt = build_stmt (RETURN_EXPR, retval);
+  TREE_NO_WARNING (ret_stmt) |= no_warning;
+  return add_stmt (ret_stmt);
 }
 
 struct c_switch {
--- gcc/cp/typeck.c.jj	2005-08-27 10:12:56.000000000 +0200
+++ gcc/cp/typeck.c	2005-09-05 11:44:02.000000000 +0200
@@ -6115,10 +6115,12 @@ maybe_warn_about_returning_address_of_lo
 /* Check that returning RETVAL from the current function is valid.
    Return an expression explicitly showing all conversions required to
    change RETVAL into the function return type, and to assign it to
-   the DECL_RESULT for the function.  */
+   the DECL_RESULT for the function.  Set *NO_WARNING to true if
+   code reaches end of non-void function warning shouldn't be issued
+   on this RETURN_EXPR.  */
 
 tree
-check_return_expr (tree retval)
+check_return_expr (tree retval, bool *no_warning)
 {
   tree result;
   /* The type actually returned by the function, after any
@@ -6126,6 +6128,8 @@ check_return_expr (tree retval)
   tree valtype;
   int fn_returns_value_p;
 
+  *no_warning = false;
+
   /* A `volatile' function is one that isn't supposed to return, ever.
      (This is a G++ extension, used to get better code for functions
      that call the `volatile' function.)  */
@@ -6176,6 +6180,10 @@ check_return_expr (tree retval)
 	 end of a non-void function (which we don't, we gave a
 	 return!).  */
       current_function_returns_null = 0;
+      /* And signal caller that TREE_NO_WARNING should be set on the
+         RETURN_EXPR to avoid control reaches end of non-void function
+         warnings in tree-cfg.c.  */
+      *no_warning = true;
     }
   /* Check for a return statement with a value in a function that
      isn't supposed to return a value.  */
--- gcc/cp/semantics.c.jj	2005-09-02 09:01:25.000000000 +0200
+++ gcc/cp/semantics.c	2005-09-05 11:45:27.000000000 +0200
@@ -743,8 +743,9 @@ tree
 finish_return_stmt (tree expr)
 {
   tree r;
+  bool no_warning;
 
-  expr = check_return_expr (expr);
+  expr = check_return_expr (expr, &no_warning);
   if (!processing_template_decl)
     {
       if (DECL_DESTRUCTOR_P (current_function_decl)
@@ -760,6 +761,7 @@ finish_return_stmt (tree expr)
     }
 
   r = build_stmt (RETURN_EXPR, expr);
+  TREE_NO_WARNING (r) |= no_warning;
   r = maybe_cleanup_point_expr_void (r);
   r = add_stmt (r);
   finish_stmt ();
--- gcc/cp/cp-tree.h.jj	2005-08-30 08:24:02.000000000 +0200
+++ gcc/cp/cp-tree.h	2005-09-05 11:44:27.000000000 +0200
@@ -4321,7 +4321,7 @@ extern tree type_after_usual_arithmetic_
 extern tree composite_pointer_type		(tree, tree, tree, tree,
 						 const char*);
 extern tree merge_types				(tree, tree);
-extern tree check_return_expr			(tree);
+extern tree check_return_expr			(tree, bool *);
 #define cp_build_binary_op(code, arg1, arg2) \
   build_binary_op(code, arg1, arg2, 1)
 #define cxx_sizeof(T)  cxx_sizeof_or_alignof_type (T, SIZEOF_EXPR, true)
--- gcc/tree-cfg.c.jj	2005-08-27 10:12:46.000000000 +0200
+++ gcc/tree-cfg.c	2005-09-05 10:59:57.000000000 +0200
@@ -5121,7 +5121,8 @@ execute_warn_function_return (void)
 	{
 	  tree last = last_stmt (e->src);
 	  if (TREE_CODE (last) == RETURN_EXPR
-	      && TREE_OPERAND (last, 0) == NULL)
+	      && TREE_OPERAND (last, 0) == NULL
+	      && !TREE_NO_WARNING (last))
 	    {
 #ifdef USE_MAPPED_LOCATION
 	      location = EXPR_LOCATION (last);
--- gcc/testsuite/gcc.dg/pr23075.c.jj	2005-09-05 11:03:20.000000000 +0200
+++ gcc/testsuite/gcc.dg/pr23075.c	2005-09-05 11:08:06.000000000 +0200
@@ -0,0 +1,14 @@
+/* PR c/23075 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -Wreturn-type" } */
+
+int
+foo (void)
+{
+  return;	/* { dg-warning "with no value" } */
+}		/* { dg-bogus "control reaches end" } */
+
+int
+bar (void)
+{
+}		/* { dg-warning "control reaches end" } */
--- gcc/testsuite/g++.dg/warn/pr23075.C.jj	2005-09-05 11:03:20.000000000 +0200
+++ gcc/testsuite/g++.dg/warn/pr23075.C	2005-09-05 11:11:26.000000000 +0200
@@ -0,0 +1,14 @@
+// PR c/23075
+// { dg-do compile }
+// { dg-options "-O2 -Wreturn-type" }
+
+int
+foo (void)
+{
+  return;	// { dg-error "with no value" }
+}		// { dg-bogus "control reaches end" }
+
+int
+bar (void)
+{
+}		// { dg-warning "control reaches end" }

gcc4-pr23098.patch:
 config/i386/i386.md                 |   10 ++++------
 cse.c                               |    3 +++
 rtl.h                               |    1 +
 simplify-rtx.c                      |    8 ++++++++
 testsuite/gcc.target/i386/pr23098.c |   24 ++++++++++++++++++++++++
 5 files changed, 40 insertions(+), 6 deletions(-)

--- NEW FILE gcc4-pr23098.patch ---
2005-09-06  Jakub Jelinek  <jakub at redhat.com>

	PR rtl-optimization/23098
	* cse.c (fold_rtx_mem): Call delegitimize_address target hook.
	* simplify-rtx.c (constant_pool_reference_p): New function.
	* rtl.h (constant_pool_reference_p): New prototype.
	* config/i386/i386.md (pushf split, mov[sdx]f split): Use
	constant_pool_reference_p in condition and
	avoid_constant_pool_reference in preparation statements.

	* gcc.target/i386/pr23098.c: New test.

--- gcc/cse.c.jj	2005-08-06 10:39:54.000000000 +0200
+++ gcc/cse.c	2005-09-02 16:12:10.000000000 +0200
@@ -3462,6 +3462,9 @@ fold_rtx_mem (rtx x, rtx insn)
 	  addr = addr_ent->const_rtx;
       }
 
+    /* Call target hook to avoid the effects of -fpic etc....  */
+    addr = targetm.delegitimize_address (addr);
+
     /* If address is constant, split it into a base and integer
        offset.  */
     if (GET_CODE (addr) == SYMBOL_REF || GET_CODE (addr) == LABEL_REF)
--- gcc/config/i386/i386.md.jj	2005-08-27 10:12:50.000000000 +0200
+++ gcc/config/i386/i386.md	2005-09-05 10:03:12.000000000 +0200
@@ -2247,11 +2247,10 @@
 	(match_operand:SF 1 "memory_operand" ""))]
   "reload_completed
    && GET_CODE (operands[1]) == MEM
-   && GET_CODE (XEXP (operands[1], 0)) == SYMBOL_REF
-   && CONSTANT_POOL_ADDRESS_P (XEXP (operands[1], 0))"
+   && constant_pool_reference_p (operands[1])"
   [(set (match_dup 0)
 	(match_dup 1))]
-  "operands[1] = get_pool_constant (XEXP (operands[1], 0));")
+  "operands[1] = avoid_constant_pool_reference (operands[1]);")
 
 
 ;; %%% Kill this when call knows how to work this out.
@@ -2861,11 +2860,10 @@
    && GET_CODE (operands[1]) == MEM
    && (GET_MODE (operands[0]) == XFmode
        || GET_MODE (operands[0]) == SFmode || GET_MODE (operands[0]) == DFmode)
-   && GET_CODE (XEXP (operands[1], 0)) == SYMBOL_REF
-   && CONSTANT_POOL_ADDRESS_P (XEXP (operands[1], 0))"
+   && constant_pool_reference_p (operands[1])"
   [(set (match_dup 0) (match_dup 1))]
 {
-  rtx c = get_pool_constant (XEXP (operands[1], 0));
+  rtx c = avoid_constant_pool_reference (operands[1]);
   rtx r = operands[0];
 
   if (GET_CODE (r) == SUBREG)
--- gcc/rtl.h.jj	2005-08-27 10:12:46.000000000 +0200
+++ gcc/rtl.h	2005-09-05 09:59:28.000000000 +0200
@@ -1542,6 +1542,7 @@ extern rtx simplify_gen_subreg (enum mac
 extern rtx simplify_replace_rtx (rtx, rtx, rtx);
 extern rtx simplify_rtx (rtx);
 extern rtx avoid_constant_pool_reference (rtx);
+extern bool constant_pool_reference_p (rtx x);
 extern bool mode_signbit_p (enum machine_mode, rtx);
 
 /* In regclass.c  */
--- gcc/simplify-rtx.c.jj	2005-08-21 15:27:00.000000000 +0200
+++ gcc/simplify-rtx.c	2005-09-05 09:58:47.000000000 +0200
@@ -209,6 +209,14 @@ avoid_constant_pool_reference (rtx x)
 
   return x;
 }
+
+/* Return true if X is a MEM referencing the constant pool.  */
+
+bool
+constant_pool_reference_p (rtx x)
+{
+  return avoid_constant_pool_reference (x) != x;
+}
 
 /* Make a unary operation by first seeing if it folds and otherwise making
    the specified operation.  */
--- gcc/testsuite/gcc.target/i386/pr23098.c.jj	2005-09-02 16:51:22.000000000 +0200
+++ gcc/testsuite/gcc.target/i386/pr23098.c	2005-09-02 16:51:42.000000000 +0200
@@ -0,0 +1,24 @@
+/* PR rtl-optimization/23098 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -fPIC" } */
+/* { dg-final { scan-assembler-not "\.LC\[0-9\]" } } */
+
+double foo (float);
+
+double
+f1 (void)
+{
+  return foo (1.0);
+}
+
+double
+f2 (void)
+{
+  return foo (0.0);
+}
+
+void
+f3 (float *x, float t)
+{
+  *x = 0.0 + t;
+}




More information about the fedora-cvs-commits mailing list