Re: restore bootstrap with a C++ compiler

2011-04-28 Thread Richard Sandiford
Gabriel Dos Reis  writes:
> Andrew Pinski  writes:
>
> | On Wed, Apr 27, 2011 at 6:48 PM, Gabriel Dos Reis  wrote:
> | > A local `extern' declaration does not give the entity an external linkage
> | > -- irrespective of the linkage of the function enclosing the declaration.
> | > It just makes the name locally available for name lookup
> | > purpose.   A variable declared const has
> | >  -- external linkage by default in C
> | >  -- internal linkage by default in C++
> | >
> | > So before the patch: the variables had external linkage in C, but
> | > internal linkage in C++.  That meant that a link will fail in C++, but
> | > succeeds in C.  All my patch did was to give the external linkage
> | > explicitly (both in C and in C++.)
> | 
> | Then I think a better fix is to do:
> | Index: internal-fn.c
> | ===
> | --- internal-fn.c   (revision 172940)
> | +++ internal-fn.c   (working copy)
> | @@ -27,6 +27,7 @@ along with GCC; see the file COPYING3.
> |  #include "gimple.h"
> | 
> |  /* The names of each internal function, indexed by function number.  */
> | +extern const char *const internal_fn_name_array[];
> |  const char *const internal_fn_name_array[] = {
> |  #define DEF_INTERNAL_FN(CODE, FLAGS) #CODE,
> |  #include "internal-fn.def"
> | @@ -35,6 +36,7 @@ const char *const internal_fn_name_array
> |  };
> | 
> |  /* The ECF_* flags of each internal function, indexed by function number.  
> */
> | +extern const int internal_fn_flags_array[];
> |  const int internal_fn_flags_array[] = {
> |  #define DEF_INTERNAL_FN(CODE, FLAGS) FLAGS,
> |  #include "internal-fn.def"
> | --- CUT ---
> | So nobody is tempted to use those arrays directly from the code but
> | rather only use the static inline functions.
>
> Well, anybody who can put those extern declarations anywhere and use
> them directly.  The real issue is that the array variables have external
> linkage.
>
> So, I think the patch is largely stylistic but equivalent; I'll defer to
> you which one should "prevail".

FWIW, I prefer Andrew's patch, but since yours has been applied,
I suppose there's no point changing it.

Richard


[PATCH][5/n] Alias housekeeping

2011-04-28 Thread Richard Guenther

This splits call handling from find_func_aliases into a separate
function.  Following patches will then be easier to read.

Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk.

Richard.

2011-04-28  Richard Guenther  

* tree-ssa-structalias.c (find_func_aliases_for_builtin_call):
New function split out from ...
(find_func_aliases): ... here.  Call it.
(find_func_aliases_for_call): Likewise.

Index: gcc/tree-ssa-structalias.c
===
--- gcc/tree-ssa-structalias.c  (revision 173034)
+++ gcc/tree-ssa-structalias.c  (working copy)
@@ -4002,6 +4002,354 @@ get_fi_for_callee (gimple call)
 gcc_unreachable ();
 }
 
+/* Create constraints for the builtin call T.  Return true if the call
+   was handled, otherwise false.  */
+
+static bool
+find_func_aliases_for_builtin_call (gimple t)
+{
+  tree fndecl = gimple_call_fndecl (t);
+  VEC(ce_s, heap) *lhsc = NULL;
+  VEC(ce_s, heap) *rhsc = NULL;
+  varinfo_t fi;
+
+  if (fndecl != NULL_TREE
+  && DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL)
+/* ???  All builtins that are handled here need to be handled
+   in the alias-oracle query functions explicitly!  */
+switch (DECL_FUNCTION_CODE (fndecl))
+  {
+  /* All the following functions return a pointer to the same object
+as their first argument points to.  The functions do not add
+to the ESCAPED solution.  The functions make the first argument
+pointed to memory point to what the second argument pointed to
+memory points to.  */
+  case BUILT_IN_STRCPY:
+  case BUILT_IN_STRNCPY:
+  case BUILT_IN_BCOPY:
+  case BUILT_IN_MEMCPY:
+  case BUILT_IN_MEMMOVE:
+  case BUILT_IN_MEMPCPY:
+  case BUILT_IN_STPCPY:
+  case BUILT_IN_STPNCPY:
+  case BUILT_IN_STRCAT:
+  case BUILT_IN_STRNCAT:
+   {
+ tree res = gimple_call_lhs (t);
+ tree dest = gimple_call_arg (t, (DECL_FUNCTION_CODE (fndecl)
+  == BUILT_IN_BCOPY ? 1 : 0));
+ tree src = gimple_call_arg (t, (DECL_FUNCTION_CODE (fndecl)
+ == BUILT_IN_BCOPY ? 0 : 1));
+ if (res != NULL_TREE)
+   {
+ get_constraint_for (res, &lhsc);
+ if (DECL_FUNCTION_CODE (fndecl) == BUILT_IN_MEMPCPY
+ || DECL_FUNCTION_CODE (fndecl) == BUILT_IN_STPCPY
+ || DECL_FUNCTION_CODE (fndecl) == BUILT_IN_STPNCPY)
+   get_constraint_for_ptr_offset (dest, NULL_TREE, &rhsc);
+ else
+   get_constraint_for (dest, &rhsc);
+ process_all_all_constraints (lhsc, rhsc);
+ VEC_free (ce_s, heap, lhsc);
+ VEC_free (ce_s, heap, rhsc);
+   }
+ get_constraint_for_ptr_offset (dest, NULL_TREE, &lhsc);
+ get_constraint_for_ptr_offset (src, NULL_TREE, &rhsc);
+ do_deref (&lhsc);
+ do_deref (&rhsc);
+ process_all_all_constraints (lhsc, rhsc);
+ VEC_free (ce_s, heap, lhsc);
+ VEC_free (ce_s, heap, rhsc);
+ return true;
+   }
+  case BUILT_IN_MEMSET:
+   {
+ tree res = gimple_call_lhs (t);
+ tree dest = gimple_call_arg (t, 0);
+ unsigned i;
+ ce_s *lhsp;
+ struct constraint_expr ac;
+ if (res != NULL_TREE)
+   {
+ get_constraint_for (res, &lhsc);
+ get_constraint_for (dest, &rhsc);
+ process_all_all_constraints (lhsc, rhsc);
+ VEC_free (ce_s, heap, lhsc);
+ VEC_free (ce_s, heap, rhsc);
+   }
+ get_constraint_for_ptr_offset (dest, NULL_TREE, &lhsc);
+ do_deref (&lhsc);
+ if (flag_delete_null_pointer_checks
+ && integer_zerop (gimple_call_arg (t, 1)))
+   {
+ ac.type = ADDRESSOF;
+ ac.var = nothing_id;
+   }
+ else
+   {
+ ac.type = SCALAR;
+ ac.var = integer_id;
+   }
+ ac.offset = 0;
+ FOR_EACH_VEC_ELT (ce_s, lhsc, i, lhsp)
+ process_constraint (new_constraint (*lhsp, ac));
+ VEC_free (ce_s, heap, lhsc);
+ return true;
+   }
+  /* All the following functions do not return pointers, do not
+modify the points-to sets of memory reachable from their
+arguments and do not add to the ESCAPED solution.  */
+  case BUILT_IN_SINCOS:
+  case BUILT_IN_SINCOSF:
+  case BUILT_IN_SINCOSL:
+  case BUILT_IN_FREXP:
+  case BUILT_IN_FREXPF:
+  case BUILT_IN_FREXPL:
+  case BUILT_IN_GAMMA_R:
+  case BUILT_IN_GAMMAF_R:
+  case BUILT_IN_GAMMAL_R:
+  case BUILT_IN_LGAMMA_R:
+  case BUILT_IN_LGAMMAF_R:
+  case BUILT_IN_LGAMMAL_R:
+  case BUILT_IN_MODF:
+  case BUILT_IN_MODFF:
+  case BUILT_IN_MODFL:
+  case BUILT_IN_REMQUO:
+  case BUIL

[PATCH][6/n] Alias housekeeping

2011-04-28 Thread Richard Guenther

This changes PTA graph dumps to DOT format and dumps before
and after solving.  It also moves succ graph building after
freeing substitution info, reducing peak memory usage slightly.

Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk.

Richard.

2011-04-28  Richard Guenther  

* tree-ssa-structalias.c (dump_constraint): Don't end the line.
(debug_constraint): Do it here.
(dump_constraints): And here.
(rewrite_constraints): And here.
(dump_constraint_edge): Remove.
(dump_constraint_graph): Rewrite to produce DOT output.
(solve_constraints): Build succ graph as late as possible.
Dump constraint graphs before and after solving.

Index: gcc/tree-ssa-structalias.c
===
*** gcc/tree-ssa-structalias.c.orig 2011-02-02 16:17:27.0 +0100
--- gcc/tree-ssa-structalias.c  2011-02-02 16:33:10.0 +0100
*** dump_constraint (FILE *file, constraint_
*** 707,713 
  fprintf (file, " + UNKNOWN");
else if (c->rhs.offset != 0)
  fprintf (file, " + " HOST_WIDE_INT_PRINT_DEC, c->rhs.offset);
-   fprintf (file, "\n");
  }
  
  
--- 707,712 
*** DEBUG_FUNCTION void
*** 723,728 
--- 722,728 
  debug_constraint (constraint_t c)
  {
dump_constraint (stderr, c);
+   fprintf (stderr, "\n");
  }
  
  /* Print out all constraints to FILE */
*** dump_constraints (FILE *file, int from)
*** 733,739 
int i;
constraint_t c;
for (i = from; VEC_iterate (constraint_t, constraints, i, c); i++)
! dump_constraint (file, c);
  }
  
  /* Print out all constraints to stderr.  */
--- 733,743 
int i;
constraint_t c;
for (i = from; VEC_iterate (constraint_t, constraints, i, c); i++)
! if (c)
!   {
!   dump_constraint (file, c);
!   fprintf (file, "\n");
!   }
  }
  
  /* Print out all constraints to stderr.  */
*** debug_constraints (void)
*** 744,829 
dump_constraints (stderr, 0);
  }
  
- /* Print out to FILE the edge in the constraint graph that is created by
-constraint c. The edge may have a label, depending on the type of
-constraint that it represents. If complex1, e.g: a = *b, then the label
-is "=*", if complex2, e.g: *a = b, then the label is "*=", if
-complex with an offset, e.g: a = b + 8, then the label is "+".
-Otherwise the edge has no label.  */
- 
- static void
- dump_constraint_edge (FILE *file, constraint_t c)
- {
-   if (c->rhs.type != ADDRESSOF)
- {
-   const char *src = get_varinfo (c->rhs.var)->name;
-   const char *dst = get_varinfo (c->lhs.var)->name;
-   fprintf (file, "  \"%s\" -> \"%s\" ", src, dst);
-   /* Due to preprocessing of constraints, instructions like *a = *b are
-  illegal; thus, we do not have to handle such cases.  */
-   if (c->lhs.type == DEREF)
- fprintf (file, " [ label=\"*=\" ] ;\n");
-   else if (c->rhs.type == DEREF)
- fprintf (file, " [ label=\"=*\" ] ;\n");
-   else
- {
-   /* We must check the case where the constraint is an offset.
-  In this case, it is treated as a complex constraint.  */
-   if (c->rhs.offset != c->lhs.offset)
- fprintf (file, " [ label=\"+\" ] ;\n");
-   else
- fprintf (file, " ;\n");
- }
- }
- }
- 
  /* Print the constraint graph in dot format.  */
  
  static void
  dump_constraint_graph (FILE *file)
  {
!   unsigned int i=0, size;
!   constraint_t c;
  
/* Only print the graph if it has already been initialized:  */
if (!graph)
  return;
  
-   /* Print the constraints used to produce the constraint graph. The
-  constraints will be printed as comments in the dot file:  */
-   fprintf (file, "\n\n/* Constraints used in the constraint graph:\n");
-   dump_constraints (file, 0);
-   fprintf (file, "*/\n");
- 
/* Prints the header of the dot file:  */
-   fprintf (file, "\n\n// The constraint graph in dot format:\n");
fprintf (file, "strict digraph {\n");
fprintf (file, "  node [\nshape = box\n  ]\n");
fprintf (file, "  edge [\nfontsize = \"12\"\n  ]\n");
!   fprintf (file, "\n  // List of nodes in the constraint graph:\n");
  
!   /* The next lines print the nodes in the graph. In order to get the
!  number of nodes in the graph, we must choose the minimum between the
!  vector VEC (varinfo_t, varmap) and graph->size. If the graph has not
!  yet been initialized, then graph->size == 0, otherwise we must only
!  read nodes that have an entry in VEC (varinfo_t, varmap).  */
!   size = VEC_length (varinfo_t, varmap);
!   size = size < graph->size ? size : graph->size;
!   for (i = 0; i < size; i++)
  {
!   const char *name = get_varinfo (graph->rep[i])->name;
!   fprintf (file, "  \"%s\" ;\n", name);
  }
  
!   /* Go over the list of constraints printing the

Re: [PATCH][libstdc++] Also install cxxabi_tweaks.h in freestanding mode.

2011-04-28 Thread Paolo Carlini

On 04/28/2011 03:37 AM, Doug Kwan (關振德) wrote:

Hi,

This patch causes cxxabi_tweaks.h to be installed in freestanding
mode.  We need this because libsupc++ installs cxxabi.h, which
includes cxx_tweaks.h.
Makes sense. Did you install your other similar tweak to 4_6-branch too? 
In that case, I would suggest doing the same for this one too. Please 
wait 48 hours though, in case other maintainers have different opinions.


Thanks,
Paolo.

PS: Normally, regenerated files are not posted.


Re: C++ PATCH for libstdc++/48760 (list-initialization of complex)

2011-04-28 Thread Paolo Carlini

On 04/28/2011 03:36 AM, Jason Merrill wrote:
In the discussion of 48760, Gaby suggested that we allow 
list-initialization of built-in complex numbers.  This made a lot of 
sense to me, so I've gone ahead and implemented it.
Great. Thus, as regards the std::complex constructor application of 
this, I'm going to fix the problem completely in mainline (either in the 
initializer for c++0x, or in the body for c++03) and only in c++03 mode 
in the branch.


Thanks again,
Paolo.


PING: ARM definition of array_mode_supported_p

2011-04-28 Thread Richard Sandiford
Ping for the ARM-specific parts of this patch:

http://gcc.gnu.org/ml/gcc-patches/2011-04/msg01752.html

which improves the handling of arrays of vectors.

Richard


[PATCH] Testcases for fixed PRs

2011-04-28 Thread Richard Guenther

Committed.

Richard.

2011-04-28  Richard Guenther  

PR tree-optimization/40052
PR tree-optimization/15347
* gcc.dg/tree-ssa/vrp57.c: New testcase.
* gcc.dg/pr15347.c: Likewise.

Index: gcc/testsuite/gcc.dg/tree-ssa/vrp57.c
===
--- gcc/testsuite/gcc.dg/tree-ssa/vrp57.c   (revision 0)
+++ gcc/testsuite/gcc.dg/tree-ssa/vrp57.c   (revision 0)
@@ -0,0 +1,17 @@
+/* PR40052 */
+/* { dg-do compile } */
+/* { dg-options "-O -ftree-vrp -fdump-tree-optimized" } */
+
+int foo(_Bool b)
+{
+return b | 1;
+}
+
+int bar(_Bool b)
+{
+return b & -2;
+}
+
+/* { dg-final { scan-tree-dump "return 0;" "optimized" } } */
+/* { dg-final { scan-tree-dump "return 1;" "optimized" } } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */
Index: gcc/testsuite/gcc.dg/pr15347.c
===
--- gcc/testsuite/gcc.dg/pr15347.c  (revision 0)
+++ gcc/testsuite/gcc.dg/pr15347.c  (revision 0)
@@ -0,0 +1,10 @@
+/* { dg-do link } */
+
+extern void link_error (void);
+int
+main ()
+{
+  if ("<12ers" + 1 == 0)
+link_error ();
+  return 0;
+}


[C++ Patch, committed] PR 48530 (again)

2011-04-28 Thread Paolo Carlini

Hi,

tested x86_64-linux, committed to mainline.

Paolo.


/cp
2011-04-28  Paolo Carlini  

PR c++/48530
* tree.c (build_cplus_new): Check build_target_expr return
value for error_mark_node.

/testsuite
2011-04-28  Paolo Carlini  

PR c++/48530
* g++.dg/cpp0x/sfinae18.C: New.
Index: testsuite/g++.dg/cpp0x/sfinae18.C
===
--- testsuite/g++.dg/cpp0x/sfinae18.C   (revision 0)
+++ testsuite/g++.dg/cpp0x/sfinae18.C   (revision 0)
@@ -0,0 +1,17 @@
+// PR c++/48530
+// { dg-options -std=c++0x }
+
+template
+char f(int);
+
+template
+char (&f(...))[2];
+
+struct DelDtor {
+  DelDtor() = default;
+  ~DelDtor() = delete;
+};
+
+static_assert(sizeof(f(0)) != 1, "Error");
Index: cp/tree.c
===
--- cp/tree.c   (revision 173061)
+++ cp/tree.c   (working copy)
@@ -1,6 +1,6 @@
 /* Language-dependent node constructors for parse phase of GNU compiler.
Copyright (C) 1987, 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
-   1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010
+   1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010, 2011
Free Software Foundation, Inc.
Hacked by Michael Tiemann (tiem...@cygnus.com)
 
@@ -456,8 +456,10 @@ build_cplus_new (tree type, tree init, tsubst_flag
 return rval;
 
   rval = build_target_expr (slot, rval, complain);
-  TARGET_EXPR_IMPLICIT_P (rval) = 1;
 
+  if (rval != error_mark_node)
+TARGET_EXPR_IMPLICIT_P (rval) = 1;
+
   return rval;
 }
 


[v3] Fix libstdc++/48760 (library proper part)

2011-04-28 Thread Paolo Carlini

Hi,

now that Jason implemented list-initialization of complex in mainline, 
we can fix this completely in the library. For 4_6-branch I mean to fix 
it only in C++03 mode, where we can do work in the body (the constructor 
is constexpr in C++0x mode).


Tested x86_64-linux, applied to mainline.

Paolo.


2011-04-28  Paolo Carlini  

PR libstdc++/48760
* include/std/complex (complex::complex(float, float),
complex::complex(double, double),
complex::complex(long double, long double)): Use
list-initialization in C++0x mode, initialize in the body in
C++03 mode.
* testsuite/26_numerics/complex/cons/48760.cc: New.
* testsuite/26_numerics/complex/cons/48760_c++0x.cc: Likewise.

2011-04-28  Paolo Carlini  

* include/std/bitset (_Base_bitset(unsigned long long)): Minor
tweak, remove redundant round braces.

Index: include/std/bitset
===
--- include/std/bitset  (revision 173064)
+++ include/std/bitset  (working copy)
@@ -80,11 +80,11 @@
 
 #ifdef __GXX_EXPERIMENTAL_CXX0X__
   constexpr _Base_bitset(unsigned long long __val)
-  : _M_w({ _WordT(__val)
+  : _M_w{ _WordT(__val)
 #if __SIZEOF_LONG_LONG__ > __SIZEOF_LONG__
   , _WordT(__val >> _GLIBCXX_BITSET_BITS_PER_WORD)
 #endif
-   }) { }
+   } { }
 #else
   _Base_bitset(unsigned long __val)
   : _M_w()
Index: include/std/complex
===
--- include/std/complex (revision 173064)
+++ include/std/complex (working copy)
@@ -1,7 +1,7 @@
 // The template and inlines for the -*- C++ -*- complex number classes.
 
 // Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
-// 2006, 2007, 2008, 2009, 2010
+// 2006, 2007, 2008, 2009, 2010, 2011
 // Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
@@ -1046,7 +1046,14 @@
   _GLIBCXX_CONSTEXPR complex(_ComplexT __z) : _M_value(__z) { }
 
   _GLIBCXX_CONSTEXPR complex(float __r = 0.0f, float __i = 0.0f)
-  : _M_value(__r + __i * 1.0fi) { }
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+  : _M_value{ __r, __i } { }
+#else
+  {
+   __real__ _M_value = __r;
+   __imag__ _M_value = __i;
+  }
+#endif
 
   explicit _GLIBCXX_CONSTEXPR complex(const complex&);
   explicit _GLIBCXX_CONSTEXPR complex(const complex&);
@@ -1186,7 +1193,14 @@
   _GLIBCXX_CONSTEXPR complex(_ComplexT __z) : _M_value(__z) { }
 
   _GLIBCXX_CONSTEXPR complex(double __r = 0.0, double __i = 0.0)
-  : _M_value(__r + __i * 1.0i) { }
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+  : _M_value{ __r, __i } { }
+#else
+  {
+   __real__ _M_value = __r;
+   __imag__ _M_value = __i;
+  }
+#endif
 
   _GLIBCXX_CONSTEXPR complex(const complex& __z)
   : _M_value(__z.__rep()) { }
@@ -1328,7 +1342,14 @@
 
   _GLIBCXX_CONSTEXPR complex(long double __r = 0.0L, 
 long double __i = 0.0L)
-  : _M_value(__r + __i * 1.0Li) { }
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+  : _M_value{ __r, __i } { }
+#else
+  {
+   __real__ _M_value = __r;
+   __imag__ _M_value = __i;
+  }
+#endif
 
   _GLIBCXX_CONSTEXPR complex(const complex& __z)
   : _M_value(__z.__rep()) { }
Index: testsuite/26_numerics/complex/cons/48760.cc
===
--- testsuite/26_numerics/complex/cons/48760.cc (revision 0)
+++ testsuite/26_numerics/complex/cons/48760.cc (revision 0)
@@ -0,0 +1,56 @@
+// Copyright (C) 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3.  If not see
+// .
+
+#include 
+#include 
+#include 
+
+template
+  void do_test01()
+  {
+bool test __attribute__((unused)) = true;
+
+if (std::numeric_limits::has_quiet_NaN)
+  {
+   std::complex c1(T(0), std::numeric_limits::quiet_NaN());
+   VERIFY( c1.real() == T(0) );
+   VERIFY( std::isnan(c1.imag()) );
+
+   std::complex c2(std::numeric_limits::quiet_NaN(), T(0));
+   VERIFY( std::isnan(c2.real()) );
+   VERIFY( c2.imag() == T(0) );
+
+   std::complex c3(std::numeric_limits::quiet_NaN(),
+  std::numeric_limit

Propagate will_be_nonconstant in ipa-analysis

2011-04-28 Thread Jan Hubicka

Hi,
tthis patch makes inliner to handle nested expressions when trying to figure 
out what
will be constant after inlining.  This is done by simple propagation across SSA 
names.
We can't really handle PHIs well, since we know name will be constant, but we 
don't know
what, so this is a lot weakter than SCCP, should be enough for cases inliner is 
interested in.

We would get better results running this in DFS order, but at the momemnt we 
don't have any
funcition computing it when cfun is not set.  I will do that incrementally.

Bootstrapped/regtested x86_64-linux, will commit it later today.

Honza

* ipa-inline-analysis.c (will_be_nonconstant_predicate): Take 
nonconstant_names
array.
(estimate_function_body_sizes): Build nonconstant_names array; handle
BUILT_IN_CONSTANT_P.
Index: ipa-inline-analysis.c
===
*** ipa-inline-analysis.c   (revision 173042)
--- ipa-inline-analysis.c   (working copy)
*** edge_execution_predicate (struct ipa_nod
*** 931,940 
gimple_cond_rhs (last));
  }
  
  static struct predicate
  will_be_nonconstant_predicate (struct ipa_node_params *info,
   struct inline_summary *summary,
!  gimple stmt)
  {
struct predicate p = true_predicate ();
ssa_op_iter iter;
--- 931,953 
gimple_cond_rhs (last));
  }
  
+ 
+ /* We keep info about constantness of SSA names.  */
+ 
+ typedef struct predicate predicate_t;
+ DEF_VEC_O (predicate_t);
+ DEF_VEC_ALLOC_O (predicate_t, heap);
+ 
+ 
+ /* Return predicate specifying when the STMT might have result that is not a 
compile
+time constant.  */
+ 
  static struct predicate
  will_be_nonconstant_predicate (struct ipa_node_params *info,
   struct inline_summary *summary,
!  gimple stmt,
!  VEC (predicate_t, heap) *nonconstant_names)
! 
  {
struct predicate p = true_predicate ();
ssa_op_iter iter;
*** will_be_nonconstant_predicate (struct ip
*** 949,955 
&& gimple_code (stmt) != GIMPLE_SWITCH)
  return p;
  
!   /* Stores and loads will stay anyway.  */
if (gimple_vuse (stmt))
  return p;
  
--- 962,969 
&& gimple_code (stmt) != GIMPLE_SWITCH)
  return p;
  
!   /* Stores and loads will stay anyway.
!  TODO: Constant memory accesses could be handled here, too.  */
if (gimple_vuse (stmt))
  return p;
  
*** will_be_nonconstant_predicate (struct ip
*** 957,977 
   adding conditionals.  */
FOR_EACH_SSA_TREE_OPERAND (use, stmt, iter, SSA_OP_USE)
  {
!   /* TODO: handle nested expressions and constant
!array accesses.  */
!   if (TREE_CODE (use) != SSA_NAME
! || !SSA_NAME_IS_DEFAULT_DEF (use)
! || ipa_get_param_decl_index (info, SSA_NAME_VAR (use)) < 0)
return p;
  }
op_non_const = false_predicate ();
FOR_EACH_SSA_TREE_OPERAND (use, stmt, iter, SSA_OP_USE)
  {
!   p = add_condition (summary,
!ipa_get_param_decl_index (info, SSA_NAME_VAR (use)),
!IS_NOT_CONSTANT, NULL);
op_non_const = or_predicates (&p, &op_non_const);
  }
return op_non_const;
  }
  
--- 971,1006 
   adding conditionals.  */
FOR_EACH_SSA_TREE_OPERAND (use, stmt, iter, SSA_OP_USE)
  {
!   if (TREE_CODE (use) != SSA_NAME)
return p;
+   /* For arguments we can build a condition.  */
+   if (SSA_NAME_IS_DEFAULT_DEF (use)
+ && ipa_get_param_decl_index (info, SSA_NAME_VAR (use)) >= 0)
+   continue;
+   /* If we know when operand is constant,
+we still can say something useful.  */
+   if (!true_predicate_p (VEC_index (predicate_t, nonconstant_names,
+   SSA_NAME_VERSION (use
+   continue;
+   return p;
  }
op_non_const = false_predicate ();
FOR_EACH_SSA_TREE_OPERAND (use, stmt, iter, SSA_OP_USE)
  {
!   if (SSA_NAME_IS_DEFAULT_DEF (use)
! && ipa_get_param_decl_index (info, SSA_NAME_VAR (use)) >= 0)
!   p = add_condition (summary,
!  ipa_get_param_decl_index (info, SSA_NAME_VAR (use)),
!  IS_NOT_CONSTANT, NULL);
!   else
!   p = *VEC_index (predicate_t, nonconstant_names,
!   SSA_NAME_VERSION (use));
op_non_const = or_predicates (&p, &op_non_const);
  }
+   if (gimple_code (stmt) == GIMPLE_ASSIGN
+   && TREE_CODE (gimple_assign_lhs (stmt)) == SSA_NAME)
+ VEC_replace (predicate_t, nonconstant_names,
+SSA_NAME_VERSION (gimple_assign_lhs (stmt)), &op_non_const);
return op_non_const;
  }
  
*** estimate_function_body_sizes (struct cgr
*** 994,1002 
int freq;
  

Re: FDO patch -- make ic related vars TLS if target allows

2011-04-28 Thread Jan Hubicka
> Hi please review the trivial patch below. It reduces race conditions
> in value profiling. Another trivial change (to initialize
> function_list struct) is also included.
> 
> Bootstrapped and regression tested on x86-64/linux.
OK,
thanks!
Honza


Re: [RFC] Context sensitive inline analysis

2011-04-28 Thread David Edelsohn
Honza,

I continue to receive an ICE:

/farm/dje/src/src/libstdc++-v3/include/precompiled/stdc++.h:94:0:
/tmp/20110427/powerpc-ibm-aix5.3.0.0/libstdc++-v3/include/valarray:1163:1:
internal compiler error: vector VEC(tree,base) index domain error, in
evaluate_conditions_for_edge at ipa-inline-analysis.c:537

I was able to bootstrap with GCC just prior to your patch on Friday.

- David

On Wed, Apr 27, 2011 at 10:44 AM, Jan Hubicka  wrote:
>>
>> This may have caused:
>>
>> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48791
>
> Oops, yes, it is mine.  The insertion hook at expansion time is incorrectly 
> called
> after function is expanded, not before.
> ipa-prop should deregister itself earlier, but that can be done incrementally.
> I am testing the following and will commit if testing succeeds.
>
> Index: cgraphunit.c
> ===
> --- cgraphunit.c        (revision 173025)
> +++ cgraphunit.c        (working copy)
> @@ -233,6 +233,7 @@ cgraph_process_new_functions (void)
>          cgraph_finalize_function (fndecl, false);
>          cgraph_mark_reachable_node (node);
>          output = true;
> +          cgraph_call_function_insertion_hooks (node);
>          break;
>
>        case CGRAPH_STATE_IPA:
> @@ -258,12 +259,14 @@ cgraph_process_new_functions (void)
>          free_dominance_info (CDI_DOMINATORS);
>          pop_cfun ();
>          current_function_decl = NULL;
> +          cgraph_call_function_insertion_hooks (node);
>          break;
>
>        case CGRAPH_STATE_EXPANSION:
>          /* Functions created during expansion shall be compiled
>             directly.  */
>          node->process = 0;
> +          cgraph_call_function_insertion_hooks (node);
>          cgraph_expand_function (node);
>          break;
>
> @@ -271,7 +274,6 @@ cgraph_process_new_functions (void)
>          gcc_unreachable ();
>          break;
>        }
> -      cgraph_call_function_insertion_hooks (node);
>       varpool_analyze_pending_decls ();
>     }
>   return output;
>


Re: (build) Patch to fix cp/cfns.gperf building issues

2011-04-28 Thread Nicola Pero
>> Ok?
>
> Ping?

PS: For the maintainer who will (eventually) review this patch,
the latest version, tested and with all the comments and contributions
from Joseph and Mike merged in, is --

http://gcc.gnu.org/ml/gcc-patches/2011-04/msg01930.html

So, that's the one to review.



[patch, vectorizer] Fix PR tree-optimization/48765

2011-04-28 Thread Ira Rosen

Hi,

Sometimes loop vectorization factor changes during the analysis, while
statement analysis depends on it. This patch moves the update of the
vectorization before statements, avoiding current difference between the
analysis and the transformations phases that caused the problem described
in the PR.

Bootstrapped and now testing on powerpc64-suse-linux.
I'll commit the patch once the testing completes.

Ira

ChangeLog:

PR tree-optimization/48765
* tree-vect-loop.c (vect_analyze_loop_operations): Scan the
statements
and update the vectorization factor according to the type of
vectorization before statement analysis.
(vectorizable_reduction): Set number of copies to 1 in case of pure
SLP
statement.
* tree-vect-stmts.c (vectorizable_conversion,
vectorizable_assignment,
vectorizable_shift, vectorizable_operation,
vectorizable_type_demotion,
vectorizable_type_promotion, vectorizable_store, vectorizable_load):
Likewise.
(vectorizable_condition): Move the check that it is not SLP
vectorization before the number of copies check.

testsuite/ChangeLog:

PR tree-optimization/48765
* gcc.dg/vect/pr48765.c: New.


Index: tree-vect-loop.c
===
--- tree-vect-loop.c(revision 173018)
+++ tree-vect-loop.c(working copy)
@@ -1167,7 +1167,38 @@ vect_analyze_loop_operations (loop_vec_info loop_v

   gcc_assert (LOOP_VINFO_VECT_FACTOR (loop_vinfo));
   vectorization_factor = LOOP_VINFO_VECT_FACTOR (loop_vinfo);
+  /* If all the stmts in the loop can be SLPed, we perform only SLP, and
+ vectorization factor of the loop is the unrolling factor required by
the
+ SLP instances.  If that unrolling factor is 1, we say, that we
perform
+ pure SLP on loop - cross iteration parallelism is not exploited.  */
+  for (i = 0; i < nbbs; i++)
+{
+  basic_block bb = bbs[i];
+  for (si = gsi_start_bb (bb); !gsi_end_p (si); gsi_next (&si))
+{
+  gimple stmt = gsi_stmt (si);
+  stmt_vec_info stmt_info = vinfo_for_stmt (stmt);
+  gcc_assert (stmt_info);
+  if ((STMT_VINFO_RELEVANT_P (stmt_info)
+   || VECTORIZABLE_CYCLE_DEF (STMT_VINFO_DEF_TYPE
(stmt_info)))
+  && !PURE_SLP_STMT (stmt_info))
+/* STMT needs both SLP and loop-based vectorization.  */
+only_slp_in_loop = false;
+}
+}

+  if (only_slp_in_loop)
+vectorization_factor = LOOP_VINFO_SLP_UNROLLING_FACTOR (loop_vinfo);
+  else
+vectorization_factor = least_common_multiple (vectorization_factor,
+LOOP_VINFO_SLP_UNROLLING_FACTOR
(loop_vinfo));
+
+  LOOP_VINFO_VECT_FACTOR (loop_vinfo) = vectorization_factor;
+
+  if (vect_print_dump_info (REPORT_DETAILS))
+fprintf (vect_dump, "Updating vectorization factor to %d ",
+ vectorization_factor);
+
   for (i = 0; i < nbbs; i++)
 {
   basic_block bb = bbs[i];
@@ -1272,18 +1303,8 @@ vect_analyze_loop_operations (loop_vec_info loop_v
   for (si = gsi_start_bb (bb); !gsi_end_p (si); gsi_next (&si))
 {
   gimple stmt = gsi_stmt (si);
-  stmt_vec_info stmt_info = vinfo_for_stmt (stmt);
-
-  gcc_assert (stmt_info);
-
  if (!vect_analyze_stmt (stmt, &need_to_vectorize, NULL))
return false;
-
-  if ((STMT_VINFO_RELEVANT_P (stmt_info)
-   || VECTORIZABLE_CYCLE_DEF (STMT_VINFO_DEF_TYPE
(stmt_info)))
-  && !PURE_SLP_STMT (stmt_info))
-/* STMT needs both SLP and loop-based vectorization.  */
-only_slp_in_loop = false;
 }
 } /* bbs */

@@ -1303,18 +1324,6 @@ vect_analyze_loop_operations (loop_vec_info loop_v
   return false;
 }

-  /* If all the stmts in the loop can be SLPed, we perform only SLP, and
- vectorization factor of the loop is the unrolling factor required by
the
- SLP instances.  If that unrolling factor is 1, we say, that we
perform
- pure SLP on loop - cross iteration parallelism is not exploited.  */
-  if (only_slp_in_loop)
-vectorization_factor = LOOP_VINFO_SLP_UNROLLING_FACTOR (loop_vinfo);
-  else
-vectorization_factor = least_common_multiple (vectorization_factor,
-LOOP_VINFO_SLP_UNROLLING_FACTOR
(loop_vinfo));
-
-  LOOP_VINFO_VECT_FACTOR (loop_vinfo) = vectorization_factor;
-
   if (LOOP_VINFO_NITERS_KNOWN_P (loop_vinfo)
   && vect_print_dump_info (REPORT_DETAILS))
 fprintf (vect_dump,
@@ -4136,7 +4145,7 @@ vectorizable_reduction (gimple stmt, gimple_stmt_i
   if (STMT_VINFO_LIVE_P (vinfo_for_stmt (reduc_def_stmt)))
 return false;

-  if (slp_node)
+  if (slp_node || PURE_SLP_STMT (stmt_info))
 ncopies = 1;
   else
 ncopies = (LOOP_VINFO_VECT_FACTOR (loop_vinfo)
Index: tree-vect-stmts.c
===
--- tree-vect-stmts.c  

[PATCH] Fix PR48804

2011-04-28 Thread Richard Guenther

Looking closer reveals a use-after-free, so this reverts the
portion of the patch likely causing 48804.

Committed as obvious.

Richard.

2011-04-28  Richard Guenther  

Revert
2011-04-28  Richard Guenther  

* tree-ssa-structalias.c (solve_constraints): Build succ graph
as late as possible.

Index: gcc/tree-ssa-structalias.c
===
--- gcc/tree-ssa-structalias.c  (revision 173066)
+++ gcc/tree-ssa-structalias.c  (working copy)
@@ -6359,10 +6359,11 @@ solve_constraints (void)
 fprintf (dump_file, "Rewriting constraints and unifying "
 "variables\n");
   rewrite_constraints (graph, si);
-  free_var_substitution_info (si);
 
   build_succ_graph ();
 
+  free_var_substitution_info (si);
+
   /* Attach complex constraints to graph nodes.  */
   move_complex_constraints (graph);
 


Re: [RFC] Context sensitive inline analysis

2011-04-28 Thread Jan Hubicka
> Honza,
> 
> I continue to receive an ICE:
> 
> /farm/dje/src/src/libstdc++-v3/include/precompiled/stdc++.h:94:0:
> /tmp/20110427/powerpc-ibm-aix5.3.0.0/libstdc++-v3/include/valarray:1163:1:
> internal compiler error: vector VEC(tree,base) index domain error, in
> evaluate_conditions_for_edge at ipa-inline-analysis.c:537
> 
> I was able to bootstrap with GCC just prior to your patch on Friday.
Hi,
can I have a preprocessed testcase? The one attached to HP PR don't seem
to reproduce for me.  Perhaps we just need a bounds check here though I think
we should catch all "evil" edges with can_inline_edge_p and never try to 
propagate
across those.

Honza


[PATCH] Make cgraph_preserve_function_body_p accept a node instead of decl

2011-04-28 Thread Martin Jambor
Hi,

when I was removing the cgraph_node function I noticed that
cgraph_preserve_function_body_p takes a tree decl parameter which it
immediately converts to a call graph node while its two callers get
the decl from a node they already have.  This seems wasteful and so
the patch below changes the parameter to be a cgraph_node which avoids
the lookup.

Because cgraph_get_node(node->decl) may be a way of getting the actual
node for a same body alias (a strange way, but well...), I added a
test for same body aliases to the function too.

I have bootstrapped and tested the patch on x86_64-linux without
problems.  OK for trunk?

Thanks,

Martin


2011-04-22  Martin Jambor  

* cgraphunit.c (cgraph_preserve_function_body_p): Accept a cgraph
node instead of a decl.  Update all callers.
* cgraph.h: Update declaration.

Index: src/gcc/cgraphunit.c
===
--- src.orig/gcc/cgraphunit.c
+++ src/gcc/cgraphunit.c
@@ -1578,7 +1578,7 @@ cgraph_expand_function (struct cgraph_no
   /* Make sure that BE didn't give up on compiling.  */
   gcc_assert (TREE_ASM_WRITTEN (decl));
   current_function_decl = NULL;
-  gcc_assert (!cgraph_preserve_function_body_p (decl));
+  gcc_assert (!cgraph_preserve_function_body_p (node));
   cgraph_release_function_body (node);
   /* Eliminate all call edges.  This is important so the GIMPLE_CALL no longer
  points to the dead function body.  */
@@ -1756,13 +1756,12 @@ cgraph_output_in_order (void)
 /* Return true when function body of DECL still needs to be kept around
for later re-use.  */
 bool
-cgraph_preserve_function_body_p (tree decl)
+cgraph_preserve_function_body_p (struct cgraph_node *node)
 {
-  struct cgraph_node *node;
-
   gcc_assert (cgraph_global_info_ready);
+  if (node->same_body_alias)
+node = node->same_body;
   /* Look if there is any clone around.  */
-  node = cgraph_get_node (decl);
   if (node->clones)
 return true;
   return false;
Index: src/gcc/ipa-inline-transform.c
===
--- src.orig/gcc/ipa-inline-transform.c
+++ src/gcc/ipa-inline-transform.c
@@ -307,7 +307,7 @@ inline_transform (struct cgraph_node *no
 
   /* We might need the body of this function so that we can expand
  it inline somewhere else.  */
-  if (cgraph_preserve_function_body_p (node->decl))
+  if (cgraph_preserve_function_body_p (node))
 save_inline_function_body (node);
 
   for (e = node->callees; e; e = e->next_callee)
Index: src/gcc/cgraph.h
===
--- src.orig/gcc/cgraph.h
+++ src/gcc/cgraph.h
@@ -578,7 +578,7 @@ void cgraph_mark_needed_node (struct cgr
 void cgraph_mark_address_taken_node (struct cgraph_node *);
 void cgraph_mark_reachable_node (struct cgraph_node *);
 bool cgraph_inline_p (struct cgraph_edge *, cgraph_inline_failed_t *reason);
-bool cgraph_preserve_function_body_p (tree);
+bool cgraph_preserve_function_body_p (struct cgraph_node *);
 void verify_cgraph (void);
 void verify_cgraph_node (struct cgraph_node *);
 void cgraph_build_static_cdtor (char which, tree body, int priority);



Re: [PATCH] Make cgraph_preserve_function_body_p accept a node instead of decl

2011-04-28 Thread Richard Guenther
On Thu, Apr 28, 2011 at 3:31 PM, Martin Jambor  wrote:
> Hi,
>
> when I was removing the cgraph_node function I noticed that
> cgraph_preserve_function_body_p takes a tree decl parameter which it
> immediately converts to a call graph node while its two callers get
> the decl from a node they already have.  This seems wasteful and so
> the patch below changes the parameter to be a cgraph_node which avoids
> the lookup.
>
> Because cgraph_get_node(node->decl) may be a way of getting the actual
> node for a same body alias (a strange way, but well...), I added a
> test for same body aliases to the function too.
>
> I have bootstrapped and tested the patch on x86_64-linux without
> problems.  OK for trunk?

An alias shouldn't have a body, so why not assert !node->same_body_alias
instead.?

Richard.

> Thanks,
>
> Martin
>
>
> 2011-04-22  Martin Jambor  
>
>        * cgraphunit.c (cgraph_preserve_function_body_p): Accept a cgraph
>        node instead of a decl.  Update all callers.
>        * cgraph.h: Update declaration.
>
> Index: src/gcc/cgraphunit.c
> ===
> --- src.orig/gcc/cgraphunit.c
> +++ src/gcc/cgraphunit.c
> @@ -1578,7 +1578,7 @@ cgraph_expand_function (struct cgraph_no
>   /* Make sure that BE didn't give up on compiling.  */
>   gcc_assert (TREE_ASM_WRITTEN (decl));
>   current_function_decl = NULL;
> -  gcc_assert (!cgraph_preserve_function_body_p (decl));
> +  gcc_assert (!cgraph_preserve_function_body_p (node));
>   cgraph_release_function_body (node);
>   /* Eliminate all call edges.  This is important so the GIMPLE_CALL no longer
>      points to the dead function body.  */
> @@ -1756,13 +1756,12 @@ cgraph_output_in_order (void)
>  /* Return true when function body of DECL still needs to be kept around
>    for later re-use.  */
>  bool
> -cgraph_preserve_function_body_p (tree decl)
> +cgraph_preserve_function_body_p (struct cgraph_node *node)
>  {
> -  struct cgraph_node *node;
> -
>   gcc_assert (cgraph_global_info_ready);
> +  if (node->same_body_alias)
> +    node = node->same_body;
>   /* Look if there is any clone around.  */
> -  node = cgraph_get_node (decl);
>   if (node->clones)
>     return true;
>   return false;
> Index: src/gcc/ipa-inline-transform.c
> ===
> --- src.orig/gcc/ipa-inline-transform.c
> +++ src/gcc/ipa-inline-transform.c
> @@ -307,7 +307,7 @@ inline_transform (struct cgraph_node *no
>
>   /* We might need the body of this function so that we can expand
>      it inline somewhere else.  */
> -  if (cgraph_preserve_function_body_p (node->decl))
> +  if (cgraph_preserve_function_body_p (node))
>     save_inline_function_body (node);
>
>   for (e = node->callees; e; e = e->next_callee)
> Index: src/gcc/cgraph.h
> ===
> --- src.orig/gcc/cgraph.h
> +++ src/gcc/cgraph.h
> @@ -578,7 +578,7 @@ void cgraph_mark_needed_node (struct cgr
>  void cgraph_mark_address_taken_node (struct cgraph_node *);
>  void cgraph_mark_reachable_node (struct cgraph_node *);
>  bool cgraph_inline_p (struct cgraph_edge *, cgraph_inline_failed_t *reason);
> -bool cgraph_preserve_function_body_p (tree);
> +bool cgraph_preserve_function_body_p (struct cgraph_node *);
>  void verify_cgraph (void);
>  void verify_cgraph_node (struct cgraph_node *);
>  void cgraph_build_static_cdtor (char which, tree body, int priority);
>
>


Re: Toplevel cleanup: disable Java when libffi not supported

2011-04-28 Thread Joseph S. Myers
On Thu, 28 Apr 2011, Paolo Bonzini wrote:

> Do you plan to finish the switch to unsupported_languages instead of
> noconfigdirs soon )for Java)?

I plan one further patch to simplify the libgcj-disabling logic (and in 
particular to eliminate the disabling for *-*-*), but not to convert it 
completely to unsupported_languages.  I also plan to split the 
newlib/libgloss logic out of the general case statement over targets, as 
part of further simplifications there.  I don't plan to work on the 
general elimination of target-libiberty.

-- 
Joseph S. Myers
jos...@codesourcery.com


Re: restore bootstrap with a C++ compiler

2011-04-28 Thread Gabriel Dos Reis
Richard Sandiford  writes:

| Gabriel Dos Reis  writes:
| > Andrew Pinski  writes:
| >
| > | On Wed, Apr 27, 2011 at 6:48 PM, Gabriel Dos Reis  
wrote:
| > | > A local `extern' declaration does not give the entity an external 
linkage
| > | > -- irrespective of the linkage of the function enclosing the 
declaration.
| > | > It just makes the name locally available for name lookup
| > | > purpose.   A variable declared const has
| > | >  -- external linkage by default in C
| > | >  -- internal linkage by default in C++
| > | >
| > | > So before the patch: the variables had external linkage in C, but
| > | > internal linkage in C++.  That meant that a link will fail in C++, but
| > | > succeeds in C.  All my patch did was to give the external linkage
| > | > explicitly (both in C and in C++.)
| > | 
| > | Then I think a better fix is to do:
| > | Index: internal-fn.c
| > | ===
| > | --- internal-fn.c (revision 172940)
| > | +++ internal-fn.c (working copy)
| > | @@ -27,6 +27,7 @@ along with GCC; see the file COPYING3.
| > |  #include "gimple.h"
| > | 
| > |  /* The names of each internal function, indexed by function number.  */
| > | +extern const char *const internal_fn_name_array[];
| > |  const char *const internal_fn_name_array[] = {
| > |  #define DEF_INTERNAL_FN(CODE, FLAGS) #CODE,
| > |  #include "internal-fn.def"
| > | @@ -35,6 +36,7 @@ const char *const internal_fn_name_array
| > |  };
| > | 
| > |  /* The ECF_* flags of each internal function, indexed by function 
number.  */
| > | +extern const int internal_fn_flags_array[];
| > |  const int internal_fn_flags_array[] = {
| > |  #define DEF_INTERNAL_FN(CODE, FLAGS) FLAGS,
| > |  #include "internal-fn.def"
| > | --- CUT ---
| > | So nobody is tempted to use those arrays directly from the code but
| > | rather only use the static inline functions.
| >
| > Well, anybody who can put those extern declarations anywhere and use
| > them directly.  The real issue is that the array variables have external
| > linkage.
| >
| > So, I think the patch is largely stylistic but equivalent; I'll defer to
| > you which one should "prevail".
| 
| FWIW, I prefer Andrew's patch, but since yours has been applied,
| I suppose there's no point changing it.

when we come to agree on coding style guidelines for GCC in C++, I hope we
recommend against local extern declarations.

-- Gaby


Re: restore bootstrap with a C++ compiler

2011-04-28 Thread Richard Sandiford
Gabriel Dos Reis  writes:
> | FWIW, I prefer Andrew's patch, but since yours has been applied,
> | I suppose there's no point changing it.
>
> when we come to agree on coding style guidelines for GCC in C++, I hope we
> recommend against local extern declarations.

Oh, for pure C++, I definitely agree.  This sort of thing ought to
be marked as private or some such in a C++ context.  But while we're
confining ourselves to a subset of C, I think local externs are a useful
way of hiding implementation details.

Richard


Re: [PATCH] C++0x, teach the parser to parse virt-specifier-seq for member functions

2011-04-28 Thread Ville Voutilainen
On 28 April 2011 01:40, Gabriel Dos Reis  wrote:
> My configuration command line is:
>  /home/gdr/src/gcc.svn/configure --enable-languages=c,c++
> --enable-build-with-cxx --disable-multilib --disable-nls
> and the builds is progressing quite very well with "g++".
> There is no need for manual setting of -fpermissive.

It goes quite far, but fails at stage1. This is without any patches of mine...

libbackend.a(gimple.o): In function `internal_fn_flags':
/home/ville/projects/c++/gcc-git/gcc/villebuild/gcc/../../gcc/internal-fn.h:46:
undefined reference to `internal_fn_flags_array'
libbackend.a(gimple-pretty-print.o): In function `internal_fn_name':
/home/ville/projects/c++/gcc-git/gcc/villebuild/gcc/../../gcc/internal-fn.h:37:
undefined reference to `internal_fn_name_array'
libbackend.a(tree-ssa-dom.o): In function `internal_fn_name':
/home/ville/projects/c++/gcc-git/gcc/villebuild/gcc/../../gcc/internal-fn.h:37:
undefined reference to `internal_fn_name_array'
collect2: ld returned 1 exit status
make[3]: *** [cc1] Error 1
make[3]: *** Waiting for unfinished jobs
libbackend.a(gimple.o): In function `internal_fn_flags':
/home/ville/projects/c++/gcc-git/gcc/villebuild/gcc/../../gcc/internal-fn.h:46:
undefined reference to `internal_fn_flags_array'
libbackend.a(gimple-pretty-print.o): In function `internal_fn_name':
/home/ville/projects/c++/gcc-git/gcc/villebuild/gcc/../../gcc/internal-fn.h:37:
undefined reference to `internal_fn_name_array'
libbackend.a(tree-ssa-dom.o): In function `internal_fn_name':
/home/ville/projects/c++/gcc-git/gcc/villebuild/gcc/../../gcc/internal-fn.h:37:
undefined reference to `internal_fn_name_array'
collect2: ld returned 1 exit status
make[3]: *** [lto1] Error 1
libbackend.a(gimple.o): In function `internal_fn_flags':
/home/ville/projects/c++/gcc-git/gcc/villebuild/gcc/../../gcc/internal-fn.h:46:
undefined reference to `internal_fn_flags_array'
libbackend.a(gimple-pretty-print.o): In function `internal_fn_name':
/home/ville/projects/c++/gcc-git/gcc/villebuild/gcc/../../gcc/internal-fn.h:37:
undefined reference to `internal_fn_name_array'
libbackend.a(tree-ssa-dom.o): In function `internal_fn_name':
/home/ville/projects/c++/gcc-git/gcc/villebuild/gcc/../../gcc/internal-fn.h:37:
undefined reference to `internal_fn_name_array'
collect2: ld returned 1 exit status
make[3]: *** [cc1plus] Error 1
rm gcov.pod gfdl.pod cpp.pod fsf-funding.pod gcc.pod
make[3]: Leaving directory `/home/ville/projects/c++/gcc-git/gcc/villebuild/gcc'
make[2]: *** [all-stage1-gcc] Error 2
make[2]: Leaving directory `/home/ville/projects/c++/gcc-git/gcc/villebuild'
make[1]: *** [stage1-bubble] Error 2
make[1]: Leaving directory `/home/ville/projects/c++/gcc-git/gcc/villebuild'
make: *** [all] Error 2


Re: [PATCH] C++0x, teach the parser to parse virt-specifier-seq for member functions

2011-04-28 Thread Gabriel Dos Reis
On Thu, Apr 28, 2011 at 8:57 AM, Ville Voutilainen
 wrote:
> On 28 April 2011 01:40, Gabriel Dos Reis  
> wrote:
>> My configuration command line is:
>>  /home/gdr/src/gcc.svn/configure --enable-languages=c,c++
>> --enable-build-with-cxx --disable-multilib --disable-nls
>> and the builds is progressing quite very well with "g++".
>> There is no need for manual setting of -fpermissive.
>
> It goes quite far, but fails at stage1. This is without any patches of mine...
>
> libbackend.a(gimple.o): In function `internal_fn_flags':
> /home/ville/projects/c++/gcc-git/gcc/villebuild/gcc/../../gcc/internal-fn.h:46:
> undefined reference to `internal_fn_flags_array'
> libbackend.a(gimple-pretty-print.o): In function `internal_fn_name':
> /home/ville/projects/c++/gcc-git/gcc/villebuild/gcc/../../gcc/internal-fn.h:37:
> undefined reference to `internal_fn_name_array'
> libbackend.a(tree-ssa-dom.o): In function `internal_fn_name':
> /home/ville/projects/c++/gcc-git/gcc/villebuild/gcc/../../gcc/internal-fn.h:37:
> undefined reference to `internal_fn_name_array'
> collect2: ld returned 1 exit status

Thanks.  Fixed yesterday evening.

-- Gaby


Re: [google] Use R_ARM_GOT_PREL to simplify global address loading from GOT (issue4433079)

2011-04-28 Thread dnovillo

I only have some stylistic comments for this patch.  The new pass looks
OK to me, but I do not know this area well enough to do a good review.

In your ChangeLog entries, please remove the directory prefix from the
file names.


http://codereview.appspot.com/4433079/diff/1/gcc/hooks.c
File gcc/hooks.c (right):

http://codereview.appspot.com/4433079/diff/1/gcc/hooks.c#newcode287
gcc/hooks.c:287: return NULL;
+hook_rtx_void_null (void)
+{
+  return NULL;

s/NULL/NULL_RTX/

http://codereview.appspot.com/4433079/diff/1/gcc/simplify-got.c
File gcc/simplify-got.c (right):

http://codereview.appspot.com/4433079/diff/1/gcc/simplify-got.c#newcode83
gcc/simplify-got.c:83: return (optimize > 0) &&
targetm.got_access.get_pic_reg ();
+{
+  return (optimize > 0) && targetm.got_access.get_pic_reg ();

s/(optimize > 0)/optimize/

http://codereview.appspot.com/4433079/diff/1/gcc/simplify-got.c#newcode118
gcc/simplify-got.c:118: if (!(set && (SET_DEST (set) == pic_reg)))
+ /* If an insn both set and use pic_reg, it is in the process of
+constructing the value of pic_reg. We should also ignore it.  */
+ rtx set = single_set (insn);
+ if (!(set && (SET_DEST (set) == pic_reg)))

Extra ( ) around SET_DEST are not needed.

http://codereview.appspot.com/4433079/


Re: PING: ARM definition of array_mode_supported_p

2011-04-28 Thread Nick Clifton

Hi Richard,


Ping for the ARM-specific parts of this patch:

 http://gcc.gnu.org/ml/gcc-patches/2011-04/msg01752.html


ARM part approved.

Cheers
  Nick




Re: restore bootstrap with a C++ compiler

2011-04-28 Thread Gabriel Dos Reis
Richard Sandiford  writes:

| Gabriel Dos Reis  writes:
| > | FWIW, I prefer Andrew's patch, but since yours has been applied,
| > | I suppose there's no point changing it.
| >
| > when we come to agree on coding style guidelines for GCC in C++, I hope we
| > recommend against local extern declarations.
| 
| Oh, for pure C++, I definitely agree.  This sort of thing ought to
| be marked as private or some such in a C++ context.  But while we're
| confining ourselves to a subset of C, I think local externs are a useful
| way of hiding implementation details.


well, please apply Andrew's and revert mine then.

-- Gaby


Re: [google] Use R_ARM_GOT_PREL to simplify global address loading from GOT (issue4433079)

2011-04-28 Thread Diego Novillo
Will you be proposing this patch for trunk as well?


Diego.


Move STMT_VINFO_TYPE assignment in vectorizable_reduction

2011-04-28 Thread Richard Sandiford
When I started looking at PR 48765, I noticed that vectorizable_reduction
set STMT_VINFO_TYPE before checking the reduction cost.  This probably
doesn't matter in practice, and certainly has nothing to do with fixing
the PR (which Ira has done, thanks), but it seems like it might
cause confusion.

Tested on x86_64-linux-gnu.  OK to install?

Richard


gcc/
* tree-vect-loop.c (vectorizable_reduction): Check reduction cost
before setting STMT_VINFO_TYPE.

Index: gcc/tree-vect-loop.c
===
--- gcc/tree-vect-loop.c2011-03-30 15:49:32.0 +0100
+++ gcc/tree-vect-loop.c2011-04-27 09:11:40.0 +0100
@@ -4305,9 +4305,9 @@ vectorizable_reduction (gimple stmt, gim
 
   if (!vec_stmt) /* transformation not required.  */
 {
-  STMT_VINFO_TYPE (stmt_info) = reduc_vec_info_type;
   if (!vect_model_reduction_cost (stmt_info, epilog_reduc_code, ncopies))
 return false;
+  STMT_VINFO_TYPE (stmt_info) = reduc_vec_info_type;
   return true;
 }
 


Re: Here is an updated patch. (issue4438079)

2011-04-28 Thread Diego Novillo
On Wed, Apr 27, 2011 at 22:09, Sharad Singhai  wrote:
> Hi Diego,
>
> Thanks for the quick feedback. Here is a an updated version of the patch.
>
> 2011-04-27  Sharad Singhai  
>
>        ChangeLog.google-main
>        * params.def: Add new parameters to control peeling.
>        * tree-ssa-loop-ivcanon.c (try_unroll_loop_completely): Use
>        different peeling parameters when profile feedback is available.
>        * loop-unroll.c (decide_peel_once_rolling): Ditto.
>        (decide_peel_completely): Ditto.
>        * doc/invoke.texi: Document new peeling parameters.
>
>        testsuite/ChangeLog.google-main
>        * gcc.dg/vect/O3-vect-pr34223.c: Add new peeling
>        parameters.
>        * gcc.dg/vect/vect.exp: Allow reading flags in individual
>        tests.

OK for google/main.

Will you be submitting this patch for trunk as well?  If you get it
approved for trunk then you will not need to maintain it in
google/main :)


Diego.


Re: Here is an updated patch. (issue4438079)

2011-04-28 Thread Richard Guenther
On Thu, Apr 28, 2011 at 4:47 PM, Diego Novillo  wrote:
> On Wed, Apr 27, 2011 at 22:09, Sharad Singhai  wrote:
>> Hi Diego,
>>
>> Thanks for the quick feedback. Here is a an updated version of the patch.
>>
>> 2011-04-27  Sharad Singhai  
>>
>>        ChangeLog.google-main
>>        * params.def: Add new parameters to control peeling.
>>        * tree-ssa-loop-ivcanon.c (try_unroll_loop_completely): Use
>>        different peeling parameters when profile feedback is available.
>>        * loop-unroll.c (decide_peel_once_rolling): Ditto.
>>        (decide_peel_completely): Ditto.
>>        * doc/invoke.texi: Document new peeling parameters.
>>
>>        testsuite/ChangeLog.google-main
>>        * gcc.dg/vect/O3-vect-pr34223.c: Add new peeling
>>        parameters.
>>        * gcc.dg/vect/vect.exp: Allow reading flags in individual
>>        tests.
>
> OK for google/main.
>
> Will you be submitting this patch for trunk as well?  If you get it
> approved for trunk then you will not need to maintain it in
> google/main :)

The doc change looks weird, you should have separate entries and
not combine them.  Checking just for profile_info != NULL is bogus,
please instead check profile_status == PROFILE_READ.

Did you do any measurements to decide on the param defaults?
Parameter defaults should be documented.  Did you consider
adding a single parameter that scales the existing parameters for
hot loops with profile-feedback?

Richard.

> Diego.
>


[PATCH] Fix PR c++/48656

2011-04-28 Thread Dodji Seketeli
Hello,

At the moment G++ considers a call expression involving a member
function which implicit 'this' pointer is type dependant, as being a
type dependent expression (PR c++/47172).  The problem in this PR is
that it fails to recognize a BASELINK node as being a member function.

As a result, the call expression A::f() in the example of the patch
below is not considered type dependent and so finish_expr_stmt wrongly
makes the call expression take the code path reserved for non-dependent
expressions.

The patch below adds the BASELINK case to the relevant test, but I am
not sure if I am missing other cases of nodes that could represent a
member function call expression.

I ran a regression test with this patch (with make check) without
bootstrap on x86_64-unknown-linux-gnu and I am currently running a
full bootstrap & regression test against trunk.

OK to commit to trunk and 4.6 if the test passes?

gcc/cp/

* semantics.c (finish_call_expr): Don't forget BASELINK nodes when
considering call expressions involving a member function.

gcc/testsuite/

* gcc/testsuite/g++.dg/template/inherit7.C: New test case.
---
 gcc/cp/semantics.c   |3 ++-
 gcc/testsuite/g++.dg/template/inherit7.C |   21 +
 2 files changed, 23 insertions(+), 1 deletions(-)
 create mode 100644 gcc/testsuite/g++.dg/template/inherit7.C

diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index 16fabb8..5486dd3 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -2039,7 +2039,8 @@ finish_call_expr (tree fn, VEC(tree,gc) **args, bool 
disallow_virtual,
 is not included in *ARGS even though it is considered to
 be part of the list of arguments.  Note that this is
 related to CWG issues 515 and 1005.  */
- || ((TREE_CODE (TREE_TYPE (fn)) == METHOD_TYPE)
+ || (((TREE_CODE (TREE_TYPE (fn)) == METHOD_TYPE)
+  || BASELINK_P (fn))
  && current_class_ref
  && type_dependent_expression_p (current_class_ref)))
{
diff --git a/gcc/testsuite/g++.dg/template/inherit7.C 
b/gcc/testsuite/g++.dg/template/inherit7.C
new file mode 100644
index 000..67afbca
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/inherit7.C
@@ -0,0 +1,21 @@
+// Origin: PR c++/48656
+// { dg-options "-std=c++0x" }
+// { dg-do compile }
+
+struct A {
+ int f();
+ int f(int);
+};
+
+template  struct B : A
+{
+};
+
+template  struct C : B
+{
+void
+g()
+{
+A::f();
+}
+};
-- 
Dodji


Re: [PATCH] Make cgraph_preserve_function_body_p accept a node instead of decl

2011-04-28 Thread Martin Jambor
Hi,

On Thu, Apr 28, 2011 at 03:39:11PM +0200, Richard Guenther wrote:
> On Thu, Apr 28, 2011 at 3:31 PM, Martin Jambor  wrote:
> > Hi,
> >
> > when I was removing the cgraph_node function I noticed that
> > cgraph_preserve_function_body_p takes a tree decl parameter which it
> > immediately converts to a call graph node while its two callers get
> > the decl from a node they already have.  This seems wasteful and so
> > the patch below changes the parameter to be a cgraph_node which avoids
> > the lookup.
> >
> > Because cgraph_get_node(node->decl) may be a way of getting the actual
> > node for a same body alias (a strange way, but well...), I added a
> > test for same body aliases to the function too.
> >
> > I have bootstrapped and tested the patch on x86_64-linux without
> > problems.  OK for trunk?
> 
> An alias shouldn't have a body, so why not assert !node->same_body_alias
> instead.?

That would work as well and actually might be better, it just did not
occur to me but I did not think about this very deeply.

I'm about to bootstrap a version of the patch with an assert instead.

Thanks,

Martin


> 
> Richard.
> 
> > Thanks,
> >
> > Martin
> >
> >
> > 2011-04-22  Martin Jambor  
> >
> >        * cgraphunit.c (cgraph_preserve_function_body_p): Accept a cgraph
> >        node instead of a decl.  Update all callers.
> >        * cgraph.h: Update declaration.
> >
> > Index: src/gcc/cgraphunit.c
> > ===
> > --- src.orig/gcc/cgraphunit.c
> > +++ src/gcc/cgraphunit.c
> > @@ -1578,7 +1578,7 @@ cgraph_expand_function (struct cgraph_no
> >   /* Make sure that BE didn't give up on compiling.  */
> >   gcc_assert (TREE_ASM_WRITTEN (decl));
> >   current_function_decl = NULL;
> > -  gcc_assert (!cgraph_preserve_function_body_p (decl));
> > +  gcc_assert (!cgraph_preserve_function_body_p (node));
> >   cgraph_release_function_body (node);
> >   /* Eliminate all call edges.  This is important so the GIMPLE_CALL no 
> > longer
> >      points to the dead function body.  */
> > @@ -1756,13 +1756,12 @@ cgraph_output_in_order (void)
> >  /* Return true when function body of DECL still needs to be kept around
> >    for later re-use.  */
> >  bool
> > -cgraph_preserve_function_body_p (tree decl)
> > +cgraph_preserve_function_body_p (struct cgraph_node *node)
> >  {
> > -  struct cgraph_node *node;
> > -
> >   gcc_assert (cgraph_global_info_ready);
> > +  if (node->same_body_alias)
> > +    node = node->same_body;
> >   /* Look if there is any clone around.  */
> > -  node = cgraph_get_node (decl);
> >   if (node->clones)
> >     return true;
> >   return false;
> > Index: src/gcc/ipa-inline-transform.c
> > ===
> > --- src.orig/gcc/ipa-inline-transform.c
> > +++ src/gcc/ipa-inline-transform.c
> > @@ -307,7 +307,7 @@ inline_transform (struct cgraph_node *no
> >
> >   /* We might need the body of this function so that we can expand
> >      it inline somewhere else.  */
> > -  if (cgraph_preserve_function_body_p (node->decl))
> > +  if (cgraph_preserve_function_body_p (node))
> >     save_inline_function_body (node);
> >
> >   for (e = node->callees; e; e = e->next_callee)
> > Index: src/gcc/cgraph.h
> > ===
> > --- src.orig/gcc/cgraph.h
> > +++ src/gcc/cgraph.h
> > @@ -578,7 +578,7 @@ void cgraph_mark_needed_node (struct cgr
> >  void cgraph_mark_address_taken_node (struct cgraph_node *);
> >  void cgraph_mark_reachable_node (struct cgraph_node *);
> >  bool cgraph_inline_p (struct cgraph_edge *, cgraph_inline_failed_t 
> > *reason);
> > -bool cgraph_preserve_function_body_p (tree);
> > +bool cgraph_preserve_function_body_p (struct cgraph_node *);
> >  void verify_cgraph (void);
> >  void verify_cgraph_node (struct cgraph_node *);
> >  void cgraph_build_static_cdtor (char which, tree body, int priority);
> >
> >


PowerPC64 non-delegitimized UNSPEC_TOCREL

2011-04-28 Thread Alan Modra
This patch fixes the following warnings seen during a powerpc64
bootstrap.

libgomp/config/linux/sem.c: In function ‘gomp_sem_wait_slow’:
libgomp/config/linux/sem.c:33:1: note: non-delegitimized UNSPEC UNSPEC_TOCREL 
(44) found in variable location
libgomp/config/linux/bar.c: In function ‘gomp_barrier_wait_end’:
libgomp/config/linux/bar.c:34:1: note: non-delegitimized UNSPEC UNSPEC_TOCREL 
(44) found in variable location

What's happening is that we are getting an address that looked like
  lo_sum ((reg 31)
  (const (plus (unspec [symbol_ref ("some_var") tocrel]) 4)))

but only expect to handle something like
  lo_sum ((reg 31)
  (const (unspec [symbol_ref ("some_var") tocrel])))

I also tidied the macho code which used a mix of "orig_x" and "x",
makeing the code fragile wrt. some future change that assigns "x"
earlier in the function.  (If orig_x is a lo_sum, then x == orig_x
currently.)

Bootstrapped and regression tested powerpc64-linux.  OK to apply?

* config/rs6000/rs6000.c (rs6000_delegitimize_address): Handle
unspec plus offset.  Tidy macho code.

Index: gcc/config/rs6000/rs6000.c
===
--- gcc/config/rs6000/rs6000.c  (revision 173064)
+++ gcc/config/rs6000/rs6000.c  (working copy)
@@ -6380,7 +6380,16 @@ rs6000_delegitimize_address (rtx orig_x)
   if (GET_CODE (x) == (TARGET_CMODEL != CMODEL_SMALL ? LO_SUM : PLUS)
   && GET_CODE (XEXP (x, 1)) == CONST)
 {
+  rtx offset = NULL_RTX;
+
   y = XEXP (XEXP (x, 1), 0);
+  if (GET_CODE (y) == PLUS
+ && GET_MODE (y) == Pmode
+ && CONST_INT_P (XEXP (y, 1)))
+   {
+ offset = XEXP (y, 1);
+ y = XEXP (y, 0);
+   }
   if (GET_CODE (y) == UNSPEC
   && XINT (y, 1) == UNSPEC_TOCREL
  && ((GET_CODE (XEXP (x, 0)) == REG
@@ -6396,6 +6405,8 @@ rs6000_delegitimize_address (rtx orig_x)
  XEXP (XEXP (XEXP (x, 0), 1), 0)
{
  y = XVECEXP (y, 0, 0);
+ if (offset != NULL_RTX)
+   y = gen_rtx_PLUS (Pmode, y, offset);
  if (!MEM_P (orig_x))
return y;
  else
@@ -6405,9 +6416,9 @@ rs6000_delegitimize_address (rtx orig_x)
 
   if (TARGET_MACHO
   && GET_CODE (orig_x) == LO_SUM
-  && GET_CODE (XEXP (x, 1)) == CONST)
+  && GET_CODE (XEXP (orig_x, 1)) == CONST)
 {
-  y = XEXP (XEXP (x, 1), 0);
+  y = XEXP (XEXP (orig_x, 1), 0);
   if (GET_CODE (y) == UNSPEC
  && XINT (y, 1) == UNSPEC_MACHOPIC_OFFSET)
return XVECEXP (y, 0, 0);

-- 
Alan Modra
Australia Development Lab, IBM


[gomp3.1] Add support for parsing final and mergeable task clauses and taskyield directive

2011-04-28 Thread Jakub Jelinek
Hi!

Both final and mergeable are passed to GOMP_task in flags, but mergeable
is currently ignored, we might want to clone it on the compiler side in
that case.  taskyield calls new GOMP_taskyield function, which is currently
empty though.

2011-04-28  Jakub Jelinek  

* tree-pretty-print.c (dump_omp_clause): Handle OMP_CLAUSE_FINAL
and OMP_CLAUSE_MERGEABLE.
* tree.c (omp_clause_num_ops): Add OMP_CLAUSE_FINAL and
OMP_CLAUSE_MERGEABLE.
(omp_clause_code_name): Likewise.
(walk_tree_1): Handle OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE.
* tree.h (enum omp_clause_code): Add OMP_CLAUSE_FINAL
and OMP_CLAUSE_MERGEABLE.
(OMP_CLAUSE_FINAL_EXPR): Define.
* omp-low.c (scan_sharing_clauses): Handle OMP_CLAUSE_FINAL and
OMP_CLAUSE_MERGEABLE.
(expand_task_call): Likewise.
* c-typeck.c (c_finish_omp_clauses): Likewise.
* gimplify.c (gimplify_scan_omp_clauses,
gimplify_adjust_omp_clauses): Likewise.
* tree-nested.c (convert_nonlocal_omp_clauses,
convert_local_omp_clauses): Likewise.
* omp-builtins.def (BUILT_IN_GOMP_TASKYIELD): New builtin.
* c-parser.c (c_parser_omp_taskyield): New function.
(c_parser_pragma): Handle PRAGMA_OMP_TASKYIELD.
(c_parser_omp_clause_name): Handle final and mergeable clauses.
(c_parser_omp_clause_final, c_parser_omp_clause_mergeable): New
functions.
(c_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_FINAL
and PRAGMA_OMP_CLAUSE_MERGEABLE.
(OMP_TASK_CLAUSE_MASK): Allow final and mergeable clauses.
* doc/generic.texi: Mention OMP_CLAUSE_COLLAPSE,
OMP_CLAUSE_UNTIED, OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE.

* c-omp.c (c_finish_omp_taskyield): New function.
* c-common.h (c_finish_omp_taskyield): New prototype.
* c-pragma.c (omp_pragmas): Add taskyield.
* c-pragma.h (enum pragma_kind): Add PRAGMA_OMP_TASKYIELD.
(enum pragma_omp_clause): Add PRAGMA_OMP_CLAUSE_FINAL and
PRAGMA_OMP_CLAUSE_MERGEABLE.

* pt.c (tsubst_omp_clauses): Handle OMP_CLAUSE_FINAL and
OMP_CLAUSE_MERGEABLE.
* semantics.c (finish_omp_clauses): Likewise.
(finish_omp_taskyield): New function.
* parser.c (cp_parser_omp_clause_name): Handle final and
mergeable clauses.
(cp_parser_omp_clause_final, cp_parser_omp_clause_mergeable): New
functions.
(cp_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_FINAL
and PRAGMA_OMP_CLAUSE_MERGEABLE.
(OMP_TASK_CLAUSE_MASK): Allow final and mergeable clauses.
(cp_parser_omp_taskyield): New function.
(cp_parser_pragma): Handle PRAGMA_OMP_TASKYIELD.
* cp-tree.h (finish_omp_taskyield): New prototype.

* openmp.c (gfc_free_omp_clauses): Free also final_expr.
(OMP_CLAUSE_FINAL, OMP_CLAUSE_MERGEABLE): Define.
(gfc_match_omp_clauses): Handle parsing final and mergeable
clauses.
(OMP_TASK_CLAUSES): Allow final and mergeable clauses.
(gfc_match_omp_taskyield): New function.
(resolve_omp_clauses): Resolve final clause.
* dump-parse-tree.c (show_omp_node): Handle EXEC_OMP_TASKYIELD,
print final and mergeable clauses.
(show_code_node): Handle EXEC_OMP_TASKYIELD.
* trans-openmp.c (gfc_trans_omp_clauses): Handle final and
mergeable clauses.
(gfc_trans_omp_taskyield): New function.
(gfc_trans_omp_directive): Handle EXEC_OMP_TASKYIELD.
* gfortran.h (gfc_statement): Add ST_OMP_TASKYIELD.
(gfc_omp_clauses): Add final_expr and mergeable fields.
(gfc_exec_op): Add EXEC_OMP_TASKYIELD.
* trans.c (trans_code): Handle EXEC_OMP_TASKYIELD.
* frontend-passes.c (gfc_code_walker): Also walk final_expr.
* resolve.c (gfc_resolve_blocks, resolve_code): Handle
EXEC_OMP_TASKYIELD.
* st.c (gfc_free_statement): Likewise.
* match.h (gfc_match_omp_taskyield): New prototype.
* parse.c (decode_omp_directive): Handle taskyield directive.
(case_executable): Add ST_OMP_TASKYIELD case.
(gfc_ascii_statement): Handle ST_OMP_TASKYIELD.

* libgomp_g.h (GOMP_taskyield): New prototype.
* libgomp.map (GOMP_taskyield): Export with GOMP_3.0 symver.
* libgomp.h (struct gomp_task): Add final_task field.
* task.c (gomp_init_task): Initialize final_task.
(GOMP_task): Remove unused attribute from flags.  Handle final
tasks.
(GOMP_taskyield): New function.
(omp_in_final): Return true if if (false) or final (true) task
or descendant of final (true).
* testsuite/libgomp.c/task-5.c: New test.
* testsuite/libgomp.c++/task-8.C: New test.
* testsuite/libgomp.fortran/task3.f90: New test.

--- gcc/doc/generic.texi(revision 172776)
+++ gcc/doc/generic.texi(working copy)
@@ -2210

Re: [PATCH] Fix PR c++/48656

2011-04-28 Thread Jason Merrill

OK.

Jason


Fix initialization of warn_maybe_uninitialized

2011-04-28 Thread Michael Matz
Hi,

since the split of warn_uninitialized to warn_maybe_uninitialized the 
fortran and Ada frontends have changed behaviours (causing uninit_func.adb 
to fail).  I've left out the Java frontend because it also didn't set 
warn_uninitialized with -Wall before, and go because it doesn't do 
anything special with -Wall at all.

I'll apply this as obvious once regstrapping on x86_64-linux finishes 
without regressions.


Ciao,
Michael.

ada/
* gcc-interface/misc.c (gnat_handle_option): Set
warn_maybe_uninitialized.

fortran/
* options.c (options.c): Set warn_maybe_uninitialized.

Index: ada/gcc-interface/misc.c
===
--- ada/gcc-interface/misc.c(revision 173070)
+++ ada/gcc-interface/misc.c(working copy)
@@ -112,6 +112,7 @@ gnat_handle_option (size_t scode, const
 case OPT_Wall:
   warn_unused = value;
   warn_uninitialized = value;
+  warn_maybe_uninitialized = value;
   break;
 
 case OPT_Wmissing_prototypes:
Index: fortran/options.c
===
--- fortran/options.c   (revision 173070)
+++ fortran/options.c   (working copy)
@@ -461,6 +461,7 @@ set_Wall (int setting)
   warn_return_type = setting;
   warn_switch = setting;
   warn_uninitialized = setting;
+  warn_maybe_uninitialized = setting;
 }
 
 


Re: [gomp3.1] Add support for parsing final and mergeable task clauses and taskyield directive

2011-04-28 Thread Paolo Carlini

Hi,

minor nit:

--- libgomp/testsuite/libgomp.c++/task-8.C  (revision 0)
+++ libgomp/testsuite/libgomp.c++/task-8.C  (revision 0)
@@ -0,0 +1,44 @@
+// { dg-do run }
+
+#include
+#include
+  #pragma omp atomic read
+e = err;
+  if (e)
+abort ();
if you include  (vs ), I think it would make much 
more sense using std::abort: abort in the global namespace isn't portable.


Paolo.


Re: Get rid of warning in dwarf2out.c

2011-04-28 Thread Eric Botcazou
> Shouldn't there be a warning from newer gcc, i.e. from trunk?

The code in GCC 4.3 reads:

  /* Inline declaration after use or definition.
 ??? Should we still warn about this now we have unit-at-a-time
 mode and can get it right?
 Definitely don't complain if the decls are in different translation
 units.
 C99 permits this, so don't warn in that case.  (The function
 may not be inlined everywhere in function-at-a-time mode, but
 we still shouldn't warn.)  */
 if (DECL_DECLARED_INLINE_P (newdecl) && !DECL_DECLARED_INLINE_P (olddecl)
  && same_translation_unit_p (olddecl, newdecl)
  && flag_gnu89_inline)
{
  if (TREE_USED (olddecl))
{
  warning (0, "%q+D declared inline after being called", olddecl);
  warned = true;
}
  else if (DECL_INITIAL (olddecl))
{
  warning (0, "%q+D declared inline after its definition", olddecl);
  warned = true;
}
}

It was removed by:

2008-07-24  Jan Hubicka  

* cgraphbuild.c (record_reference): Drop non-unit-at-a-time code.
(build_cgraph_edges): Likewise.
[...]
* c-decl.c (diagnose_mismatched_decls): Do not require inline keyword
early in GNU dialect.


so I presume that the answer is no.

-- 
Eric Botcazou


Re: [SPARC] Hookize PRINT_OPERAND, PRINT_OPERAND_ADDRESS and PRINT_OPERAND_PUNCT_VALID_P

2011-04-28 Thread Richard Henderson
On 04/27/2011 11:13 AM, Anatoly Sokolov wrote:
> * config/sparc/sparc.h (PRINT_OPERAND, PRINT_OPERAND_ADDRESS,
> PRINT_OPERAND_PUNCT_VALID_P): Remove.
> * config/sparc/sparc-protos.h (print_operand): Remove declaration.
> * config/sparc/sparc.c (TARGET_PRINT_OPERAND_PUNCT_VALID_P,
> TARGET_PRINT_OPERAND, TARGET_PRINT_OPERAND_ADDRESS): Define.
> (print_operand): Rename to...
> (sparc_print_operand): ...this. Make static. Adjust
> sparc_print_operand function call.
> (sparc_print_operand_punct_valid_p, sparc_print_operand_address): New
> functions.

Ok, except, 

> +  if(code == '#'

Space before (, re-indenting the rest of the condition to match.


r~


Re: Ping^2 Re: Don't use linux.h for non-Linux targets

2011-04-28 Thread Richard Henderson
On 04/27/2011 12:16 PM, Joseph S. Myers wrote:
> Ping^2.  This patch 
>  is still pending 
> review (except insofar as it relates to GNU Hurd).
> 

Ok.

r~


Re: [patch, 4.5] Fix PR middle-end/43085 (make profiledbootstrap crashes due to dataflow bug)

2011-04-28 Thread Eric Botcazou
> The patch below is a backport of those fixes to the 4.5 branch, which
> fixes the profiled-bootstrap failure for me.  (Note that on current
> mainling, the ifcvt.c dead_or_predictable routine has been significantly
> rewritten beyond what was done by those patches.  These additional
> changes do not appear to be necessary to fix the PR ...)

Do you really need to backport the MERGE_SET_NOCLOBBER stuff?  This will cause 
the branch to optimize more aggressively than before.

-- 
Eric Botcazou


Re: [PATCH] Make cgraph_preserve_function_body_p accept a node instead of decl

2011-04-28 Thread Jan Hubicka
> > I have bootstrapped and tested the patch on x86_64-linux without
> > problems.  OK for trunk?
> 
> An alias shouldn't have a body, so why not assert !node->same_body_alias
> instead.?

Yep, patch is OK with that change.

Honza


Toplevel cleanup: reduce libgcj disabling

2011-04-28 Thread Joseph S. Myers
This patch cleans up the libgcj-disabling case statement at toplevel,
removing the default disabling for *-*-* (which allows other empty
cases to be removed) and disabling based on architecture, or most
cases of architecture-OS combination where the OS previously had
libgcj built for other architectures.

I left the logic restricting libgcj on Darwin to certain targets, but
removed that relating to FreeBSD and NetBSD targets (given the removal
of support for a.out NetBSD, and that there was never such support for
a.out FreeBSD, I doubt the reliability of the lists of targets that
were present).  target-libffi disabling for arm-*-elf* | arm*-*-eabi*
was removed (given that there *is* libffi support for those targets),
and target-zlib disabling for hppa*64*-*-linux* was changed to disable
Java.

This is the last cleanup I plan for this libgcj-disabling logic.  This
patch is *not* conservatively safe; the idea is that if it turns out
that there are problems building some Java library on a
libffi-supporting target where the library was not previously built,
appropriate disabling should be added *with a comment explaining the
problem and probably pointing to a relevant PR*.

OK to commit?

2011-04-28  Joseph Myers  

* configure.ac (*-*-dragonfly*, *-*-freebsd*, *-*-netbsd*,
alpha*-dec-osf*, alpha*-*-linux*, alpha*-*-*, sh-*-linux*,
arm-*-elf* | arm*-*-eabi*, arm*-*-linux-gnueabi, frv-*-*): Remove
cases in libgcj-disabling case statement.
(hppa*64*-*-linux*): Set unsupported_languages instead of
disabling target-zlib.
(hppa*64*-*-*): Restrict case in libgcj-disabling case statement
to hppa*64*-*-hpux*.
(hppa*-*-*): Restrict case in libgcj-disabling case statement to
hppa*-*-hpux*.
(ia64*-*-elf*, ia64*-**-hpux*, i[[3456789]]86-*-elf,
i[[3456789]]86-*-linux*, *-*-cygwin*, i[[3456789]]86-*-interix*,
i[[3456789]]86-*-solaris2*, m32r-*-*, m68k-*-elf*, m68*-*-* |
fido-*-*, powerpc-*-eabi, powerpc-*-eabi* | powerpcle-*-eabi* |
powerpc-*-rtems*, mips*-*-linux*, mips*-*-*, sh-*-* | sh64-*-*,
sparc-*-elf*, sparc64-*-elf*, sparc-*-solaris* |
sparc64-*-solaris* | sparcv9-*-solaris*, *-*-linux* | *-*-gnu* |
*-*-k*bsd*-gnu | *-*-kopensolaris*-gnu, *-*-*): Remove cases in
libgcj-disabling case statement.
* configure: Regenerate.

Index: configure.ac
===
--- configure.ac(revision 173069)
+++ configure.ac(working copy)
@@ -622,29 +622,6 @@
   *-*-darwin*)
 noconfigdirs="$noconfigdirs ${libgcj}"
 ;;
-  *-*-dragonfly*)
-;;
-  *-*-freebsd*)
-# Skip some stuff that's unsupported on some FreeBSD configurations.
-case "${target}" in
-  i*86-*-*) ;;
-  alpha*-*-*) ;;
-  x86_64-*-*) ;;
-  *)
-   noconfigdirs="$noconfigdirs ${libgcj}"
-   ;;
-esac
-;;
-  *-*-netbsd*)
-# Skip some stuff that's unsupported on some NetBSD configurations.
-case "${target}" in
-  i*86-*-netbsdelf*) ;;
-  arm*-*-netbsdelf*) ;;
-  *)
-   noconfigdirs="$noconfigdirs ${libgcj}"
-   ;;
-esac
-;;
   *-*-netware*)
 noconfigdirs="$noconfigdirs ${libgcj}"
 ;;
@@ -660,27 +637,12 @@
   *-*-vxworks*)
 noconfigdirs="$noconfigdirs ${libgcj}"
 ;;
-  alpha*-dec-osf*)
-;;
   alpha*-*-*vms*)
 noconfigdirs="$noconfigdirs ${libgcj}"
 ;;
-  alpha*-*-linux*)
-;;
-  alpha*-*-*)
-noconfigdirs="$noconfigdirs ${libgcj}"
-;;
-  sh-*-linux*)
-noconfigdirs="$noconfigdirs ${libgcj}"
-;;
   arm-wince-pe)
 noconfigdirs="$noconfigdirs ${libgcj}"
 ;;
-  arm-*-elf* | arm*-*-eabi* )
-noconfigdirs="$noconfigdirs target-libffi"
-;;
-  arm*-*-linux-gnueabi)
-;;
   arm*-*-symbianelf*)
 noconfigdirs="$noconfigdirs ${libgcj}"
 ;;
@@ -696,39 +658,25 @@
noconfigdirs="$noconfigdirs target-libffi target-boehm-gc";;
 esac
 ;;
-  frv-*-*)
-noconfigdirs="$noconfigdirs ${libgcj}"
-;;
   hppa*64*-*-linux*)
 # In this case, it's because the hppa64-linux target is for
 # the kernel only at this point and has no libc, and thus no
 # headers, crt*.o, etc., all of which are needed by these.
-noconfigdirs="$noconfigdirs target-zlib"
+unsupported_languages="$unsupported_languages java"
 ;;
-  hppa*-*-linux*)
-;;
-  hppa*64*-*-*)
+  hppa*64*-*-hpux*)
 noconfigdirs="$noconfigdirs ${libgcj}"
 ;;
   hppa*-hp-hpux11*)
 ;;
-  hppa*-*-*)
+  hppa*-*-hpux*)
 # According to Alexandre Oliva , libjava won't
 # build on HP-UX 10.20.
 noconfigdirs="$noconfigdirs ${libgcj}"
 ;;
-  ia64*-*-elf*)
-;;
-  ia64*-**-hpux*)
-;;
   ia64*-*-*vms*)
 noconfigdirs="$noconfigdirs ${libgcj}"
 ;;
-  i[[3456789]]86-*-elf)
-noconfigdirs="$noconfigdirs ${libgcj}"
-;;
-  i[[3456789]]86-*-linux*)
-;;
   i[[3456789]]86-w64-mingw*)
 noconfig

Re: [patch, 4.5] Fix PR middle-end/43085 (make profiledbootstrap crashes due to dataflow bug)

2011-04-28 Thread Ulrich Weigand
Eric Botcazou wrote:
> > The patch below is a backport of those fixes to the 4.5 branch, which
> > fixes the profiled-bootstrap failure for me.  (Note that on current
> > mainling, the ifcvt.c dead_or_predictable routine has been significantly
> > rewritten beyond what was done by those patches.  These additional
> > changes do not appear to be necessary to fix the PR ...)
> 
> Do you really need to backport the MERGE_SET_NOCLOBBER stuff?  This will 
> cause 
> the branch to optimize more aggressively than before.

Well, the specific problem I was running into is that the original 4.5 code
handled partial sets incorrectly.  My understanding was that Bernd's patch
introduced the noclobber stuff to fix this problem:

  "The function calls df_simulate_find_defs to mark all set registers as
  live, then clears anything for which it can find a REG_DEAD/REG_UNUSED
  note.  df_simulate_find_defs is broken for this purpose: it should
  ignore clobbers, but it ignores partial and conditional sets."
  (http://gcc.gnu.org/ml/gcc-patches/2010-04/msg01364.html)

I guess that patch does indeed address both correctness and performance
aspects, but I wasn't sure attempting to pull those apart was a safer option,
given that at least in its current form it has seen testing in mainline ...

I'd certainly be happy to try out a more stripped down patch; could you be
more specific about exactly which parts you want me to omit?

Thanks,
Ulrich

-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  ulrich.weig...@de.ibm.com


Re: [PATCH] Fix unwind info with inline asm (PR middle-end/48597)

2011-04-28 Thread Jason Merrill
I think this could use a comment along the lines of "make sure we flush 
any queued register saves in case this clobbers affected registers".  OK 
with that change.


Jason


Re: Toplevel cleanup: reduce libgcj disabling

2011-04-28 Thread Paolo Bonzini

On 04/28/2011 06:17 PM, Joseph S. Myers wrote:

This patch cleans up the libgcj-disabling case statement at toplevel,
removing the default disabling for *-*-* (which allows other empty
cases to be removed) and disabling based on architecture, or most
cases of architecture-OS combination where the OS previously had
libgcj built for other architectures.

I left the logic restricting libgcj on Darwin to certain targets, but
removed that relating to FreeBSD and NetBSD targets (given the removal
of support for a.out NetBSD, and that there was never such support for
a.out FreeBSD, I doubt the reliability of the lists of targets that
were present).  target-libffi disabling for arm-*-elf* | arm*-*-eabi*
was removed (given that there*is*  libffi support for those targets),
and target-zlib disabling for hppa*64*-*-linux* was changed to disable
Java.

This is the last cleanup I plan for this libgcj-disabling logic.  This
patch is*not*  conservatively safe; the idea is that if it turns out
that there are problems building some Java library on a
libffi-supporting target where the library was not previously built,
appropriate disabling should be added *with a comment explaining the
problem and probably pointing to a relevant PR*.

OK to commit?



Ok.

Paolo


Toplevel cleanup: libgloss_dir

2011-04-28 Thread Joseph S. Myers
This patch moves the libgloss_dir settings out of the general toplevel
case over targets, simplifying various target patterns in the process.
Resulting empty cases will be cleaned up when the disabling of newlib
and libgloss for various target OSes are moved to a separate case
statement.

OK to commit?

2011-04-28  Joseph Myers  

* configure.ac: Separate libgloss_dir settings from general case
over targets.
* configure: Regenerate.

--- configure.ac2011-04-28 15:53:06.0 +
+++ configure.ac.new2011-04-28 16:30:36.0 +
@@ -712,6 +712,39 @@
 libgloss_dir="$target_cpu"
 
 case "${target}" in
+  sh*-*-pe|mips*-*-pe|*arm-wince-pe)
+libgloss_dir=wince
+;;
+  arm*-*-*)
+libgloss_dir=arm
+;;
+  cris-*-* | crisv32-*-*)
+libgloss_dir=cris
+;;
+  hppa*-*-*)
+libgloss_dir=pa
+;;
+  i[[3456789]]86-*-*)
+libgloss_dir=i386
+;;
+  m68hc11-*-*|m6811-*-*|m68hc12-*-*|m6812-*-*)
+libgloss_dir=m68hc11
+;;
+  m68*-*-* | fido-*-*)
+libgloss_dir=m68k
+;;
+  mips*-*-*)
+libgloss_dir=mips
+;;
+  powerpc*-*-*)
+libgloss_dir=rs6000
+;;
+  sparc*-*-*)
+libgloss_dir=sparc
+;;
+esac
+
+case "${target}" in
   *-*-chorusos)
 noconfigdirs="$noconfigdirs target-newlib target-libgloss"
 ;;
@@ -791,25 +824,20 @@
   sh*-*-pe|mips*-*-pe|*arm-wince-pe)
 noconfigdirs="$noconfigdirs tcl tk itcl libgui sim"
 noconfigdirs="$noconfigdirs target-newlib"
-libgloss_dir=wince
 ;;
   arc-*-*)
 noconfigdirs="$noconfigdirs target-libgloss"
 ;;
   arm-*-coff)
-libgloss_dir=arm
 ;;
   arm-*-elf* | arm*-*-eabi* )
-libgloss_dir=arm
 ;;
   arm*-*-linux-gnueabi)
 case ${with_newlib} in
   no) noconfigdirs="$noconfigdirs target-newlib target-libgloss"
 esac
-libgloss_dir=arm
 ;;
   arm*-*-symbianelf*)
-libgloss_dir=arm
 ;;
   arm-*-pe*)
 noconfigdirs="$noconfigdirs target-libgloss"
@@ -835,7 +863,6 @@
   *-*-linux*)
noconfigdirs="$noconfigdirs target-newlib target-libgloss";;
 esac
-libgloss_dir=cris
 ;;
   d10v-*-*)
 noconfigdirs="$noconfigdirs target-libgloss"
@@ -872,7 +899,6 @@
 noconfigdirs="$noconfigdirs ld"
 ;;
   hppa*-*-pro*)
-libgloss_dir=pa
 ;;
   hppa*-*-*)
 noconfigdirs="$noconfigdirs ld"
@@ -893,7 +919,6 @@
 noconfigdirs="$noconfigdirs readline libgui itcl gdb ld"
 ;;
   i[[3456789]]86-*-coff | i[[3456789]]86-*-elf)
-libgloss_dir=i386
 ;;
   i[[3456789]]86-*-linux*)
 # This section makes it possible to build newlib natively on linux.
@@ -955,12 +980,10 @@
   m32r-*-*)
 ;;
   m68hc11-*-*|m6811-*-*|m68hc12-*-*|m6812-*-*)
-libgloss_dir=m68hc11
 ;;
   m68k-*-elf*)
 ;;
   m68*-*-* | fido-*-*)
-libgloss_dir=m68k
 ;;
   mmix-*-*)
 noconfigdirs="$noconfigdirs gdb"
@@ -981,16 +1004,13 @@
 # This is temporary until we can link against shared libraries
   powerpcle-*-solaris*)
 noconfigdirs="$noconfigdirs gdb sim tcl tk itcl"
-libgloss_dir=rs6000
 ;;
   powerpc-*-beos*)
 noconfigdirs="$noconfigdirs gdb target-newlib target-libgloss"
 ;;
   powerpc-*-eabi)
-libgloss_dir=rs6000
 ;;
   powerpc-*-eabi* | powerpcle-*-eabi* | powerpc-*-rtems* )
-libgloss_dir=rs6000
 ;;
   rs6000-*-lynxos*)
 noconfigdirs="$noconfigdirs target-newlib gprof"
@@ -1011,7 +1031,6 @@
 if test x$with_newlib = xyes; then
   noconfigdirs="$noconfigdirs gprof"
 fi
-libgloss_dir=mips
 ;;
   mips*-*-irix5*)
 noconfigdirs="$noconfigdirs gprof target-libgloss"
@@ -1027,7 +1046,6 @@
 ;;
   mips*-*-*)
 noconfigdirs="$noconfigdirs gprof"
-libgloss_dir=mips
 ;;
   sh-*-* | sh64-*-*)
 case "${target}" in
@@ -1038,15 +1056,12 @@
 esac
 ;;
   sparclet-*-aout* | sparc86x-*-*)
-libgloss_dir=sparc
 ;;
   sparc-*-elf*)
 ;;
   sparc64-*-elf*)
-libgloss_dir=sparc
 ;;
   sparclite-*-*)
-libgloss_dir=sparc
 ;;
   sparc-*-sunos4*)
 if test x${is_cross_compiler} != xno ; then

-- 
Joseph S. Myers
jos...@codesourcery.com


Re: [PATCH][libstdc++] Also install cxxabi_tweaks.h in freestanding mode.

2011-04-28 Thread 關振德
Hi,

Thanks.  I will wait for 2 days before checking this into trunk.
The previous fix was in the 4.6 release.  Can I also check in this fix
into 4.6 branch as well?

-Doug

On Thu, Apr 28, 2011 at 2:34 AM, Paolo Carlini  wrote:
> On 04/28/2011 03:37 AM, Doug Kwan (關振德) wrote:
>>
>> Hi,
>>
>>    This patch causes cxxabi_tweaks.h to be installed in freestanding
>> mode.  We need this because libsupc++ installs cxxabi.h, which
>> includes cxx_tweaks.h.
>
> Makes sense. Did you install your other similar tweak to 4_6-branch too? In
> that case, I would suggest doing the same for this one too. Please wait 48
> hours though, in case other maintainers have different opinions.
>
> Thanks,
> Paolo.
>
> PS: Normally, regenerated files are not posted.
>


Re: Move STMT_VINFO_TYPE assignment in vectorizable_reduction

2011-04-28 Thread Ira Rosen


gcc-patches-ow...@gcc.gnu.org wrote on 28/04/2011 05:30:35 PM:

>
> When I started looking at PR 48765, I noticed that vectorizable_reduction
> set STMT_VINFO_TYPE before checking the reduction cost.  This probably
> doesn't matter in practice, and certainly has nothing to do with fixing
> the PR (which Ira has done, thanks), but it seems like it might
> cause confusion.
>
> Tested on x86_64-linux-gnu.  OK to install?

OK.

Thanks,
Ira

>
> Richard
>
>
> gcc/
>* tree-vect-loop.c (vectorizable_reduction): Check reduction cost
>before setting STMT_VINFO_TYPE.
>
> Index: gcc/tree-vect-loop.c
> ===
> --- gcc/tree-vect-loop.c   2011-03-30 15:49:32.0 +0100
> +++ gcc/tree-vect-loop.c   2011-04-27 09:11:40.0 +0100
> @@ -4305,9 +4305,9 @@ vectorizable_reduction (gimple stmt, gim
>
>if (!vec_stmt) /* transformation not required.  */
>  {
> -  STMT_VINFO_TYPE (stmt_info) = reduc_vec_info_type;
>if (!vect_model_reduction_cost (stmt_info,
epilog_reduc_code,ncopies))
>  return false;
> +  STMT_VINFO_TYPE (stmt_info) = reduc_vec_info_type;
>return true;
>  }
>



[libffi] Provide unwind info for Tru64 UNIX in osf.S

2011-04-28 Thread Rainer Orth
While investigating the remaining testsuite failures on Tru64 UNIX, I
found that both two libffi failures and several libjava failures had a
common cause: libffi/src/alpha/osf.S lacks unwind info that is usable on
Tru64 UNIX.

The following patch fixes this, along the same lines of what was done in
src/x86/sysv.S for Solaris/x86.

Tested by rebuilding libffi and running make check and relinking the
java libraries and also running make check.

In libffi, only

FAIL: libffi.call/huge_struct.c -O0 -W -Wall execution test

and variants remains which has a different cause (still investigating),
but many libjava failures are now gone.  The remaining ones are unrelated:

FAIL: Throw_2 execution - source compiled test

SEGVs here:

java.lang.String.length()int (this=null)
at /vol/gcc/src/hg/trunk/local/libjava/java/lang/String.java:451
451 return count;

FAIL: md5test output - source compiled test

java.lang.ArrayIndexOutOfBoundsException

gdb is no help investigating.

FAIL: shatest execution - source compiled test

Probably same issue.

Ok for mainline and the 4.5 and 4.6 branches after testing there?

I cannot test the Alpha/Linux side, though.

Thanks.
Rainer


2011-04-28  Rainer Orth  

* src/alpha/osf.S (UA_SI, FDE_ENCODING, FDE_ENCODE, FDE_ARANGE):
Define.
Use them to handle ELF vs. ECOFF differences.
[__osf__] (_GLOBAL__F_ffi_call_osf): Define.

diff --git a/libffi/src/alpha/osf.S b/libffi/src/alpha/osf.S
--- a/libffi/src/alpha/osf.S
+++ b/libffi/src/alpha/osf.S
@@ -1,5 +1,5 @@
 /* ---
-   osf.S - Copyright (c) 1998, 2001, 2007, 2008 Red Hat
+   osf.S - Copyright (c) 1998, 2001, 2007, 2008, 2011 Red Hat

Alpha/OSF Foreign Function Interface 
 
@@ -299,33 +299,51 @@ ffi_closure_osf:
 #endif
 
 #ifdef __ELF__
+# define UA_SI .4byte
+# define FDE_ENCODING  0x1b/* pcrel sdata4 */
+# define FDE_ENCODE(X) .4byte X-.
+# define FDE_ARANGE(X) .4byte X
+#elif defined __osf__
+# define UA_SI .align 0; .long
+# define FDE_ENCODING  0x50/* aligned absolute */
+# define FDE_ENCODE(X) .align 3; .quad X
+# define FDE_ARANGE(X) .align 0; .quad X
+#endif
+
+#ifdef __ELF__
.section.eh_frame,EH_FRAME_FLAGS,@progbits
+#elif defined __osf__
+   .data
+   .align 3
+   .globl _GLOBAL__F_ffi_call_osf
+_GLOBAL__F_ffi_call_osf:
+#endif
 __FRAME_BEGIN__:
-   .4byte  $LECIE1-$LSCIE1 # Length of Common Information Entry
+   UA_SI   $LECIE1-$LSCIE1 # Length of Common Information Entry
 $LSCIE1:
-   .4byte  0x0 # CIE Identifier Tag
+   UA_SI   0x0 # CIE Identifier Tag
.byte   0x1 # CIE Version
.ascii "zR\0"   # CIE Augmentation
.byte   0x1 # uleb128 0x1; CIE Code Alignment Factor
.byte   0x78# sleb128 -8; CIE Data Alignment Factor
.byte   26  # CIE RA Column
.byte   0x1 # uleb128 0x1; Augmentation size
-   .byte   0x1b# FDE Encoding (pcrel sdata4)
+   .byte   FDE_ENCODING# FDE Encoding
.byte   0xc # DW_CFA_def_cfa
.byte   30  # uleb128 column 30
.byte   0   # uleb128 offset 0
.align 3
 $LECIE1:
 $LSFDE1:
-   .4byte  $LEFDE1-$LASFDE1# FDE Length
+   UA_SI   $LEFDE1-$LASFDE1# FDE Length
 $LASFDE1:
-   .4byte  $LASFDE1-__FRAME_BEGIN__# FDE CIE offset
-   .4byte  $LFB1-. # FDE initial location
-   .4byte  $LFE1-$LFB1 # FDE address range
+   UA_SI   $LASFDE1-__FRAME_BEGIN__# FDE CIE offset
+   FDE_ENCODE($LFB1)   # FDE initial location
+   FDE_ARANGE($LFE1-$LFB1) # FDE address range
.byte   0x0 # uleb128 0x0; Augmentation size
 
.byte   0x4 # DW_CFA_advance_loc4
-   .4byte  $LCFI1-$LFB1
+   UA_SI   $LCFI1-$LFB1
.byte   0x9a# DW_CFA_offset, column 26
.byte   4   # uleb128 4*-8
.byte   0x8f# DW_CFA_offset, column 15
@@ -335,32 +353,35 @@ __FRAME_BEGIN__:
.byte   32  # uleb128 offset 32
 
.byte   0x4 # DW_CFA_advance_loc4
-   .4byte  $LCFI2-$LCFI1
+   UA_SI   $LCFI2-$LCFI1
.byte   0xda# DW_CFA_restore, column 26
.align 3
 $LEFDE1:
 
 $LSFDE3:
-   .4byte  $LEFDE3-$LASFDE3# FDE Length
+   UA_SI   $LEFDE3-$LASFDE3# FDE Length
 $LASFDE3:
-   .4byte  $LASFDE3-__FRAME_BEGIN__# FDE CIE offset
-   .4byte  $LFB2-. # FDE initial location
-   .4byte  $LFE2-$LFB2 # FDE address range
+   UA_SI   $LASFDE3-__FRAME_BEGIN__# FDE CIE offset
+   FDE_ENCODE($LFB2)   # FDE initial location
+   FDE_ARANGE($LFE2-$LFB2)  

Re: PowerPC64 non-delegitimized UNSPEC_TOCREL

2011-04-28 Thread David Edelsohn
On Thu, Apr 28, 2011 at 11:22 AM, Alan Modra  wrote:
> This patch fixes the following warnings seen during a powerpc64
> bootstrap.
>
> libgomp/config/linux/sem.c: In function ‘gomp_sem_wait_slow’:
> libgomp/config/linux/sem.c:33:1: note: non-delegitimized UNSPEC UNSPEC_TOCREL 
> (44) found in variable location
> libgomp/config/linux/bar.c: In function ‘gomp_barrier_wait_end’:
> libgomp/config/linux/bar.c:34:1: note: non-delegitimized UNSPEC UNSPEC_TOCREL 
> (44) found in variable location
>
> What's happening is that we are getting an address that looked like
>  lo_sum ((reg 31)
>          (const (plus (unspec [symbol_ref ("some_var") tocrel]) 4)))
>
> but only expect to handle something like
>  lo_sum ((reg 31)
>          (const (unspec [symbol_ref ("some_var") tocrel])))
>
> I also tidied the macho code which used a mix of "orig_x" and "x",
> makeing the code fragile wrt. some future change that assigns "x"
> earlier in the function.  (If orig_x is a lo_sum, then x == orig_x
> currently.)
>
> Bootstrapped and regression tested powerpc64-linux.  OK to apply?
>
>        * config/rs6000/rs6000.c (rs6000_delegitimize_address): Handle
>        unspec plus offset.  Tidy macho code.

Looks good.

Thanks, David


Re: [PATCH][libstdc++] Also install cxxabi_tweaks.h in freestanding mode.

2011-04-28 Thread Paolo Carlini

On 04/28/2011 07:16 PM, Doug Kwan (關振德) wrote:

Hi,

 Thanks.  I will wait for 2 days before checking this into trunk.
The previous fix was in the 4.6 release.  Can I also check in this fix
into 4.6 branch as well?

Yes.

Paolo.


[google][patch] Track discriminators by instruction instead of by basic block (issue4441075)

2011-04-28 Thread Cary Coutant
commit 76c5256b18ce0357dc0fc38ce143b8979318b823
Author: Cary Coutant 
Date:   Thu Apr 28 10:48:56 2011 -0700

Track discriminators by instruction instead of by basic block

Rework discriminator assignment so that it attaches the discriminator
to the source location of each instruction instead of to the basic
block itself.

This patch was submitted for review in Nov. 2009:
http://gcc.gnu.org/ml/gcc-patches/2009-11/msg00563.html

It's not ready for trunk yet because it does not yet preserve
the discriminators across LTO, so I'd like to put it in
google/main until I have a chance to get that part working.

OK for google/main?

-cary

M   gcc/basic-block.h
M   gcc/cfghooks.c
M   gcc/cfglayout.c
M   gcc/final.c
M   gcc/gimple-pretty-print.c
M   gcc/input.c
M   gcc/input.h
M   gcc/print-rtl.c
M   gcc/rtl.h
M   gcc/tree-cfg.c
M   gcc/tree-pretty-print.c

Tested:
  Bootstrapped on x86_64.

ChangeLog:

2011-04-28  Cary Coutant  

* basic-block.h (struct basic_block_def): Remove discriminator field.
* cfghooks.c (split_block): Remove discriminator field.
* cfglayout.c (insn_discriminator): New function.
* final.c (discriminator): Remove.
(override_discriminator): New file-scope variable.
(final_start_function): Remove tracking of discriminator by basic
block.
(final_scan_insn): Track discriminator by instruction.
(notice_source_line): Check for discriminator override. Get
discriminator from instruction.
* gimple-pretty-print.c (dump_gimple_stmt): Print discriminator.
(dump_bb_header): Don't print discriminator.
* input.c: Include vecprim.h.
(discriminator_location_locations): New variable.
(discriminator_location_discriminators): New variable.
(min_discriminator_location): New variable.
(expand_location): Use map_discriminator_location.
(location_with_discriminator): New function.
(has_discriminator): New function.
(map_discriminator_location): New function.
(get_discriminator_from_locus): New function.
* input.h (location_with_discriminator): New function.
(has_discriminator): New function.
(map_discriminator_location): New function.
(get_discriminator_from_locus): New function.
* print-rtl.c (print_rtx): Print discriminator.
* rtl.h (insn_discriminator): New function.
* tree-cfg.c: Include input.h.
(assign_discriminator): Assign discriminators to instructions rather
than to the basic block.
* tree-pretty-print.c (dump_location): Print discriminator.
diff --git a/gcc/basic-block.h b/gcc/basic-block.h
index 946fe9d..f46c25c 100644
--- a/gcc/basic-block.h
+++ b/gcc/basic-block.h
@@ -162,9 +162,6 @@ struct GTY((chain_next ("%h.next_bb"), chain_prev 
("%h.prev_bb"))) basic_block_d
   /* Expected frequency.  Normalized to be in range 0 to BB_FREQ_MAX.  */
   int frequency;
 
-  /* The discriminator for this block.  */
-  int discriminator;
-
   /* Various flags.  See BB_* below.  */
   int flags;
 };
diff --git a/gcc/cfghooks.c b/gcc/cfghooks.c
index c4c51cc..d77dc7c 100644
--- a/gcc/cfghooks.c
+++ b/gcc/cfghooks.c
@@ -437,7 +437,6 @@ split_block (basic_block bb, void *i)
   new_bb->count = bb->count;
   new_bb->frequency = bb->frequency;
   new_bb->loop_depth = bb->loop_depth;
-  new_bb->discriminator = bb->discriminator;
 
   if (dom_info_available_p (CDI_DOMINATORS))
 {
diff --git a/gcc/cfglayout.c b/gcc/cfglayout.c
index 548e21f..cb52634 100644
--- a/gcc/cfglayout.c
+++ b/gcc/cfglayout.c
@@ -567,6 +567,16 @@ insn_file (const_rtx insn)
   return locator_file (INSN_LOCATOR (insn));
 }
 
+/* Return discriminator of the statement that produced this insn.  */
+int
+insn_discriminator (const_rtx insn)
+{
+  int loc = INSN_LOCATOR (insn);
+  if (!loc)
+return 0;
+  return get_discriminator_from_locus (locator_location (loc));
+}
+
 /* Return true if LOC1 and LOC2 locators have the same location and scope.  */
 bool
 locator_eq (int loc1, int loc2)
diff --git a/gcc/final.c b/gcc/final.c
index df5d7d5..d89938c 100644
--- a/gcc/final.c
+++ b/gcc/final.c
@@ -134,9 +134,6 @@ static int last_linenum;
 /* Last discriminator written to assembly.  */
 static int last_discriminator;
 
-/* Discriminator of current block.  */
-static int discriminator;
-
 /* Highest line number in current block.  */
 static int high_block_linenum;
 
@@ -146,9 +143,10 @@ static int high_function_linenum;
 /* Filename of last NOTE.  */
 static const char *last_filename;
 
-/* Override filename and line number.  */
+/* Override filename, line number, and discriminator.  */
 static const char *override_filename;
 static int override_linenum;
+static int override_discriminator;
 
 /* Whether to force emission of a line note before the next insn.  */
 static bool force_source_line = false;
@@ -1539,7 +1537,7 @@ fina

Re: [google][patch] Track discriminators by instruction instead of by basic block (issue4441075)

2011-04-28 Thread Diego Novillo
On Thu, Apr 28, 2011 at 14:04, Cary Coutant  wrote:

>    Rework discriminator assignment so that it attaches the discriminator
>    to the source location of each instruction instead of to the basic
>    block itself.

Any idea on how this affects memory consumption?

>    This patch was submitted for review in Nov. 2009:
>    http://gcc.gnu.org/ml/gcc-patches/2009-11/msg00563.html
>
>    It's not ready for trunk yet because it does not yet preserve
>    the discriminators across LTO, so I'd like to put it in
>    google/main until I have a chance to get that part working.

But, IIRC this does not introduce LTO regressions, right?

> 2011-04-28  Cary Coutant  
>
>        * basic-block.h (struct basic_block_def): Remove discriminator field.
>        * cfghooks.c (split_block): Remove discriminator field.
>        * cfglayout.c (insn_discriminator): New function.
>        * final.c (discriminator): Remove.
>        (override_discriminator): New file-scope variable.
>        (final_start_function): Remove tracking of discriminator by basic
>        block.
>        (final_scan_insn): Track discriminator by instruction.
>        (notice_source_line): Check for discriminator override. Get
>        discriminator from instruction.
>        * gimple-pretty-print.c (dump_gimple_stmt): Print discriminator.
>        (dump_bb_header): Don't print discriminator.
>        * input.c: Include vecprim.h.
>        (discriminator_location_locations): New variable.
>        (discriminator_location_discriminators): New variable.
>        (min_discriminator_location): New variable.
>        (expand_location): Use map_discriminator_location.
>        (location_with_discriminator): New function.
>        (has_discriminator): New function.
>        (map_discriminator_location): New function.
>        (get_discriminator_from_locus): New function.
>        * input.h (location_with_discriminator): New function.
>        (has_discriminator): New function.
>        (map_discriminator_location): New function.
>        (get_discriminator_from_locus): New function.
>        * print-rtl.c (print_rtx): Print discriminator.
>        * rtl.h (insn_discriminator): New function.
>        * tree-cfg.c: Include input.h.
>        (assign_discriminator): Assign discriminators to instructions rather
>        than to the basic block.
>        * tree-pretty-print.c (dump_location): Print discriminator.

OK if testing passes.


Diego.


[C++ Patch, committed] PR 48798

2011-04-28 Thread Paolo Carlini

Hi,

I committed the below patchlet, per the exchange with Jason on the audit 
trail, after having regtested it on x86_64-linux.


Thanks,
Paolo.


/cp
2011-04-28  Paolo Carlini  

PR c++/48798
* semantics.c (finish_base_specifier): cv-qualified base class
is fine, per DR 484.

/testsuite
2011-04-28  Paolo Carlini  

PR c++/48798
* g++.dg/inherit/pr48798.C: New.
* g++.old-deja/g++.other/base1.C: Adjust.
Index: testsuite/g++.old-deja/g++.other/base1.C
===
--- testsuite/g++.old-deja/g++.other/base1.C(revision 173116)
+++ testsuite/g++.old-deja/g++.other/base1.C(working copy)
@@ -3,8 +3,7 @@
 // Copyright (C) 2000 Free Software Foundation, Inc.
 // Contributed by Nathan Sidwell 25 Nov 2000 
 
-// We lost information about which base wasn't an aggregate type, plus we
-// allowed cv qualifed bases via typedefs.
+// We lost information about which base wasn't an aggregate type.
 
 typedef int I;
 typedef int cI;
@@ -16,5 +15,5 @@ typedef A pA;
 
 struct B : I {};  // { dg-error "" } not an aggregate
 struct C : cI {}; // { dg-error "" } not an aggregate
-struct D : cA {}; // { dg-error "" } cv qualified
+struct D : cA {}; // cv-qualified is fine per DR 484
 struct E : pA {};
Index: testsuite/g++.dg/inherit/pr48798.C
===
--- testsuite/g++.dg/inherit/pr48798.C  (revision 0)
+++ testsuite/g++.dg/inherit/pr48798.C  (revision 0)
@@ -0,0 +1,4 @@
+// PR c++/48798
+
+typedef struct A {} const t;
+struct B : t {};
Index: cp/semantics.c
===
--- cp/semantics.c  (revision 173116)
+++ cp/semantics.c  (working copy)
@@ -2766,7 +2766,8 @@ finish_base_specifier (tree base, tree access, boo
 {
   if (cp_type_quals (base) != 0)
{
- error ("base class %qT has cv qualifiers", base);
+ /* DR 484: Can a base-specifier name a cv-qualified
+class type?  */
  base = TYPE_MAIN_VARIANT (base);
}
   result = build_tree_list (access, base);


Re: [google][patch] Track discriminators by instruction instead of by basic block (issue4441075)

2011-04-28 Thread Cary Coutant
>>    Rework discriminator assignment so that it attaches the discriminator
>>    to the source location of each instruction instead of to the basic
>>    block itself.
>
> Any idea on how this affects memory consumption?

Richard had the same question when I first proposed this patch. This
was my answer then:

"Not a lot. We assign discriminators for only a small fraction of the
total number of locations in the program, so the number of unique
location_t values doesn't increase significantly. I didn't add
anything to the line_map structure, nor did I do anything at all in
libcpp, so it's not bloating the source_location/location_t data
structures at all. The extra space needed is linear with the number of
discriminators assigned, which is roughly one per for loop or switch
statement, plus an occasional discriminator for conditional
expressions or macro expansions with control flow. (In the old code
that I'm replacing, the extra space was one int per basic block.)"

>>    It's not ready for trunk yet because it does not yet preserve
>>    the discriminators across LTO, so I'd like to put it in
>>    google/main until I have a chance to get that part working.
>
> But, IIRC this does not introduce LTO regressions, right?

Right. Even though discriminators don't survive the
streaming-out/streaming-in process, the samples obtained from an
initial non-LTO compilation will include discriminator information,
and that information survives long enough into a profile-use
compilation with LTO for the frequency information to get recorded
correctly.

-cary


[testsuite] Use -fno-common in gcc.dg/pr48616.c for Tru64 UNIX (PR tree-optimization/48775)

2011-04-28 Thread Rainer Orth
Like HP-UX, Tru64 UNIX needs -fno-common to make gcc.dg/pr48616.c pass.

Tested with the appropriate runtest invocation, installed on mainline.

Rainer


2011-04-28  Rainer Orth  

PR tree-optimization/48775
* gcc.dg/pr48616.c: Also add -fno-common on alpha*-dec-osf*.

Index: gcc/testsuite/gcc.dg/pr48616.c
===
--- gcc/testsuite/gcc.dg/pr48616.c  (revision 173124)
+++ gcc/testsuite/gcc.dg/pr48616.c  (working copy)
@@ -1,7 +1,7 @@
 /* PR tree-optimization/48616 */
 /* { dg-do run } */
 /* { dg-options "-O2 -ftree-vectorize" } */
-/* { dg-options "-O2 -ftree-vectorize -fno-common" { target hppa*-*-hpux* } } 
*/
+/* { dg-options "-O2 -ftree-vectorize -fno-common" { target alpha*-dec-osf* 
hppa*-*-hpux* } } */
 
 extern void abort (void);
 int a[4] __attribute__((aligned (32)));


-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


Re: [PATCH][libstdc++] Also install cxxabi_tweaks.h in freestanding mode.

2011-04-28 Thread Benjamin Kosnik
 
 
> 2011-04-27  Doug Kwan  
> 
>   * include/Makefile.am (install-freestanding-headers): Also
> install cxxabi_tweaks.h.
>   * include/Makefile.in: Regnerate.

OK for trunk and 4.6

-benjamin


Disable tracer by default for profile use (issue4428074)

2011-04-28 Thread Sharad Singhai
This patch disables -ftracer for profile use. Okay for google/main?

Thanks,
Sharad

2011-04-28  Sharad Singhai  

Google Ref 40087
* opts.c (common_handle_option): Disable -ftracer for profile use.
* doc/invoke.texi: Update doc that -ftracer is no longer enabled for 
FDO.

Index: doc/invoke.texi
===
--- doc/invoke.texi (revision 173048)
+++ doc/invoke.texi (working copy)
@@ -7930,7 +7930,7 @@
 generally profitable only with profile feedback available.
 
 The following options are enabled: @code{-fbranch-probabilities}, @code{-fvpt},
-@code{-funroll-loops}, @code{-fpeel-loops}, @code{-ftracer}
+@code{-funroll-loops}, @code{-fpeel-loops}.
 
 By default, GCC emits an error message if the feedback profiles do not
 match the source code.  This error can be turned into a warning by using
Index: opts.c
===
--- opts.c  (revision 173048)
+++ opts.c  (working copy)
@@ -1531,8 +1531,6 @@
opts->x_flag_unroll_loops = value;
   if (!opts_set->x_flag_peel_loops)
opts->x_flag_peel_loops = value;
-  if (!opts_set->x_flag_tracer)
-   opts->x_flag_tracer = value;
   if (!opts_set->x_flag_value_profile_transformations)
opts->x_flag_value_profile_transformations = value;
   if (!opts_set->x_flag_inline_functions)

--
This patch is available for review at http://codereview.appspot.com/4428074


Re: Disable tracer by default for profile use (issue4428074)

2011-04-28 Thread Diego Novillo
On Thu, Apr 28, 2011 at 14:51, Sharad Singhai  wrote:
> This patch disables -ftracer for profile use. Okay for google/main?

Could you elaborate on why doing this is beneficial?  Are you
proposing this for trunk as well?

> 2011-04-28  Sharad Singhai  
>
>        Google Ref 40087
>        * opts.c (common_handle_option): Disable -ftracer for profile use.
>        * doc/invoke.texi: Update doc that -ftracer is no longer enabled for 
> FDO.

OK.


Diego.


ChangeLog updated

2011-04-28 Thread Michael Meissner
Just FYI, as I was going through some of my recent changes to backport them to
the IBM 4.6 branch, I noticed I forgot to add the ChangeLog entries to the
changes I made on March 21st.  I updated the ChangeLog files.  Sorry about
that.

Index: gcc/ChangeLog
===
--- gcc/ChangeLog   (revision 173127)
+++ gcc/ChangeLog   (working copy)
@@ -6693,6 +6693,13 @@
(FBSD_TARGET_CPU_CPP_BUILTINS): ...this.
(TARGET_GNU_TLS, TARGET_SUN_TLS): Define.
 
+2011-03-21  Michael Meissner  
+
+   PR target/48226
+   * config/rs6000/rs6000-c.c (rs6000_macro_to_expand): If we see a
+   vector when peeking at the next token for vector, don't expand the
+   keywords.
+
 2011-03-21  Georg-Johann Lay  
 
* config/avr/avr-protos.h (expand_epilogue): Change prototype
Index: gcc/testsuite/ChangeLog
===
--- gcc/testsuite/ChangeLog (revision 173127)
+++ gcc/testsuite/ChangeLog (working copy)
@@ -1358,6 +1358,11 @@
PR tree-optimization/48228
* gcc.dg/Wstrict-overflow-23.c: New testcase.
 
+2011-03-21  Michael Meissner  
+
+   PR target/48226
+   * gcc.target/powerpc/pr48226.c: New file.
+
 2011-03-21  Jack Howarth  
 
* lib/prune.exp (prune_gcc_output): Prune "could not create

-- 
Michael Meissner, IBM
5 Technology Place Drive, M/S 2757, Westford, MA 01886-3141, USA
meiss...@linux.vnet.ibm.com fax +1 (978) 399-6899


Re: [patch, 4.5] Fix PR middle-end/43085 (make profiledbootstrap crashes due to dataflow bug)

2011-04-28 Thread Eric Botcazou
> I guess that patch does indeed address both correctness and performance
> aspects, but I wasn't sure attempting to pull those apart was a safer
> option, given that at least in its current form it has seen testing in
> mainline ...

Reasonable enough indeed.

> I'd certainly be happy to try out a more stripped down patch; could you be
> more specific about exactly which parts you want me to omit?

The "We can perform the transformation if" thing, but in the end I agree that 
it's probably better to backport the unmodified changes.  Thanks.

-- 
Eric Botcazou


[google] Add -fstrict-enum-precision flag (issue4433083)

2011-04-28 Thread Diego Novillo

This patch from Silvius Rus adds a new flag (-fstrict-enum-precision).
While porting the patch to 4.6, I noticed that the C++ FE now has a
similar flag that seems to have similar semantics (-fstrict-enums).

Silvius's patch is used to disable some switch() optimizations that
assume enum types can *only* take values within that enum (Silvius,
please correct me if I got this wrong).

Jason, your -fstrict-enums only applies to the C++ front end.
Silvius's variant affects VRP and gimplification of switches.  Would
it be better if we simply moved -fstrict-enums to common options and
used that to decide whether to optimize switches in VRP and the
gimplifier?

We use it internally to disable this optimization for code that
generates values outside of enum ranges.

Committed to google/main.  Jason, Silvius, what do you think would be
the best approach to merge this into trunk?

Thanks.  Diego.

2011-04-27  Silvius Rus  

* doc/invoke.texi (fno-strict-enum-precision): Document.
* gimplify.c (gimplify_switch_expr): If
-fno-strict-enum-precision is given, do not consider enum
types.
* tree-vrp.c (stmt_interesting_for_vrp): If
-fno-strict-enum-precision is given, do not look at enum
types.

2011-04-27  Silvius Rus  

* g++.dg/other/no-strict-enum-precision-1.C: New.
* g++.dg/other/no-strict-enum-precision-2.C: New.
* g++.dg/other/no-strict-enum-precision-3.C: New.

diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index cb04d91..cffc70d 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -393,8 +393,8 @@ Objective-C and Objective-C++ Dialects}.
 -fsel-sched-pipelining -fsel-sched-pipelining-outer-loops @gol
 -fsignaling-nans -fsingle-precision-constant -fsplit-ivs-in-unroller @gol
 -fsplit-wide-types -fstack-protector -fstack-protector-all @gol
--fstrict-aliasing -fstrict-overflow -fthread-jumps -ftracer @gol
--ftree-bit-ccp @gol
+-fstrict-aliasing -fstrict-overflow -fno-strict-enum-precision -fthread-jumps
+-ftracer -ftree-bit-ccp @gol
 -ftree-builtin-call-dce -ftree-ccp -ftree-ch -ftree-copy-prop @gol
 -ftree-copyrename -ftree-dce -ftree-dominator-opts -ftree-dse @gol
 -ftree-forwprop -ftree-fre -ftree-loop-if-convert @gol
@@ -2073,6 +2073,11 @@ represented in the minimum number of bits needed to 
represent all the
 enumerators).  This assumption may not be valid if the program uses a
 cast to convert an arbitrary integer value to the enumeration type.
 
+@item -fno-strict-enum-precision
+@opindex fno-strict-enum-precision
+Do not perform optimizations of switch() statements based on the
+precision of enum types.
+
 @item -ftemplate-depth=@var{n}
 @opindex ftemplate-depth
 Set the maximum instantiation depth for template classes to @var{n}.
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index 83eaedc..8984d39 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -1602,6 +1602,8 @@ gimplify_switch_expr (tree *expr_p, gimple_seq *pre_p)
type = TREE_TYPE (SWITCH_COND (switch_expr));
  if (len
  && INTEGRAL_TYPE_P (type)
+  && (flag_strict_enum_precision
+  || TREE_CODE (type) != ENUMERAL_TYPE)
  && TYPE_MIN_VALUE (type)
  && TYPE_MAX_VALUE (type)
  && tree_int_cst_equal (CASE_LOW (VEC_index (tree, labels, 0)),
diff --git a/gcc/testsuite/g++.dg/other/no-strict-enum-precision-1.C 
b/gcc/testsuite/g++.dg/other/no-strict-enum-precision-1.C
new file mode 100644
index 000..87f263c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/other/no-strict-enum-precision-1.C
@@ -0,0 +1,22 @@
+/* { dg-do run } */
+/* { dg-options "-fno-strict-enum-precision" } */
+
+enum zero_one { zero = 0, one = 1 };
+
+int* allocate_bool(zero_one e) {
+  int* v = 0;
+  switch (e) {
+case zero: v = new int(0);
+case one: v = new int(1);
+  }
+  return v;
+}
+
+int main() {
+  if (allocate_bool(static_cast(999))) {
+/* Error: should not have matched any case label.  */
+return 1;
+  } else {
+return 0;
+  }
+}
diff --git a/gcc/testsuite/g++.dg/other/no-strict-enum-precision-2.C 
b/gcc/testsuite/g++.dg/other/no-strict-enum-precision-2.C
new file mode 100644
index 000..5b6af17
--- /dev/null
+++ b/gcc/testsuite/g++.dg/other/no-strict-enum-precision-2.C
@@ -0,0 +1,26 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -fno-strict-enum-precision" } */
+
+enum X {
+  X1,
+  X2
+};
+
+int foo (enum X x) {
+  switch (x) {
+case X1:
+  return 0;
+case X2:
+  return 1;
+  }
+  return x;
+}
+
+int main(int argc, char *argv[]) {
+  int n = argc + 999;
+  if (n == foo(static_cast(n))) {
+return 0;
+  } else {
+return 1;
+  }
+}
diff --git a/gcc/testsuite/g++.dg/other/no-strict-enum-precision-3.C 
b/gcc/testsuite/g++.dg/other/no-strict-enum-precision-3.C
new file mode 100755
index 000..c3802a8
--- /dev/null
+++ b/gcc/testsuite/g++.dg/other/no-strict-enum-precision-3.C
@@ -0,0 +1,14 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -fno-strict-en

Re: [patch, vectorizer] Fix PR tree-optimization/48765

2011-04-28 Thread Ira Rosen


gcc-patches-ow...@gcc.gnu.org wrote on 28/04/2011 03:42:01 PM:

>
>
> Hi,
>
> Sometimes loop vectorization factor changes during the analysis, while
> statement analysis depends on it. This patch moves the update of the
> vectorization before statements, avoiding current difference between the
> analysis and the transformations phases that caused the problem described
> in the PR.
>
> Bootstrapped and now testing on powerpc64-suse-linux.
> I'll commit the patch once the testing completes.
>

I ended up committing a slightly different version of the patch that scans
the loop statements only if we decided to use SLP.

Bootstrapped and tested on powerpc64-suse-linux.
Committed revision 173132.

Ira

ChangeLog:

PR tree-optimization/48765
* tree-vectorizer.h (vect_make_slp_decision): Return bool.
* tree-vect-loop.c (vect_analyze_loop_operations): Add new argument
to indicate if loop aware SLP is being used.  Scan the statements
and update the vectorization factor according to the type of
vectorization before statement analysis.
(vect_analyze_loop_2): Get a return value from
vect_make_slp_decision,
pass it to vect_analyze_loop_operations.
(vectorizable_reduction): Set number of copies to 1 in case of pure
SLP statement.
* tree-vect-stmts.c (vectorizable_conversion,
vectorizable_assignment, vectorizable_shift,
vectorizable_operation, vectorizable_type_demotion,
vectorizable_type_promotion, vectorizable_store,
vectorizable_load):
Likewise.
(vectorizable_condition): Move the check that it is not SLP
vectorization before the number of copies check.
* tree-vect-slp.c (vect_make_slp_decision): Return TRUE if decided
to vectorize the loop using SLP.


testsuite/ChangeLog:

PR tree-optimization/48765
* gcc.dg/vect/pr48765.c: New.

(See attached file: pr48765.txt)Index: ChangeLog
===
--- ChangeLog   (revision 173127)
+++ ChangeLog   (working copy)
@@ -1,3 +1,25 @@
+2011-04-28  Ira Rosen  
+
+   PR tree-optimization/48765
+   * tree-vectorizer.h (vect_make_slp_decision): Return bool.
+   * tree-vect-loop.c (vect_analyze_loop_operations): Add new argument
+   to indicate if loop aware SLP is being used.  Scan the statements
+   and update the vectorization factor according to the type of
+   vectorization before statement analysis.
+   (vect_analyze_loop_2): Get a return value from vect_make_slp_decision,
+   pass it to vect_analyze_loop_operations.
+   (vectorizable_reduction): Set number of copies to 1 in case of pure
+   SLP statement.
+   * tree-vect-stmts.c (vectorizable_conversion,
+   vectorizable_assignment, vectorizable_shift,
+   vectorizable_operation, vectorizable_type_demotion,
+   vectorizable_type_promotion, vectorizable_store, vectorizable_load):
+   Likewise.
+   (vectorizable_condition): Move the check that it is not SLP
+   vectorization before the number of copies check.
+   * tree-vect-slp.c (vect_make_slp_decision): Return TRUE if decided
+   to vectorize the loop using SLP.
+
 2011-04-28  Jakub Jelinek  
 
PR middle-end/48597
Index: testsuite/gcc.dg/vect/pr48765.c
===
--- testsuite/gcc.dg/vect/pr48765.c (revision 0)
+++ testsuite/gcc.dg/vect/pr48765.c (revision 0)
@@ -0,0 +1,82 @@
+/* { dg-do compile { target powerpc*-*-* } } */
+/* { dg-options "-m64 -O3 -mcpu=power6" } */
+
+enum reg_class
+{
+  NO_REGS, AP_REG, XRF_REGS, GENERAL_REGS, AGRF_REGS, XGRF_REGS, ALL_REGS,
+LIM_REG_CLASSES
+};
+enum machine_mode
+{
+  VOIDmode, QImode, HImode, PSImode, SImode, PDImode, DImode, TImode, OImode,
+QFmode, HFmode, TQFmode, SFmode, DFmode, XFmode, TFmode, SCmode, DCmode,
+XCmode, TCmode, CQImode, CHImode, CSImode, CDImode, CTImode, COImode,
+BLKmode, CCmode, CCEVENmode, MAX_MACHINE_MODE
+};
+typedef struct rtx_def
+{
+  int mode:8;
+}
+ *rtx;
+extern rtx *regno_reg_rtx;
+typedef unsigned int HARD_REG_ELT_TYPE;
+typedef HARD_REG_ELT_TYPE HARD_REG_SET[((64 + 32 - 1) / 32)];
+extern int reg_alloc_order[64];
+extern int max_regno;
+extern int *reg_n_calls_crossed;
+extern short *reg_renumber;
+static int *reg_where_dead;
+static int *reg_where_born;
+static int *reg_order;
+static char *regs_change_size;
+static HARD_REG_SET *after_insn_hard_regs;
+static int stupid_find_reg (int, enum reg_class, enum machine_mode, int, int,
+   int);
+void
+stupid_life_analysis (f, nregs, file)
+ rtx f;
+{
+  register int i;
+  for (i = (((64)) + 3) + 1; i < max_regno; i++)
+{
+  register int r = reg_order[i];
+  if ((int) LIM_REG_CLASSES > 1)
+   reg_renumber[r] =
+ stupid_find_reg (reg_n_calls_crossed[r], reg_preferred_class (r),
+  ((regno_reg_rtx[r])->

Re: [google] Add -fstrict-enum-precision flag (issue4433083)

2011-04-28 Thread Nathan Froyd
On Thu, Apr 28, 2011 at 03:50:45PM -0400, Diego Novillo wrote:
> Committed to google/main.  Jason, Silvius, what do you think would be
> the best approach to merge this into trunk?

When this code does get merged to trunk, can the testcases abort() on
failure rather than returning 1?  This is friendlier for embedded target
testing.

-Nathan


Re: [google] Add -fstrict-enum-precision flag (issue4433083)

2011-04-28 Thread Paolo Carlini
... are the testcases formatted according to the GNU guidelines, in terms, for 
example, of open and closed curly braces? I don't think so, I see some weird 
(sorry, after all those years unavoidably look to me *really* weird) open 
braces ending lines?

Paolo


Re: [google] Add -fstrict-enum-precision flag (issue4433083)

2011-04-28 Thread Diego Novillo
On Thu, Apr 28, 2011 at 15:56, Nathan Froyd  wrote:
> On Thu, Apr 28, 2011 at 03:50:45PM -0400, Diego Novillo wrote:
>> Committed to google/main.  Jason, Silvius, what do you think would be
>> the best approach to merge this into trunk?
>
> When this code does get merged to trunk, can the testcases abort() on
> failure rather than returning 1?  This is friendlier for embedded target
> testing.

Sure.  I've changed all the returns to abort() or exit(0).


Diego.


Re: [google] Add -fstrict-enum-precision flag (issue4433083)

2011-04-28 Thread Diego Novillo
On Thu, Apr 28, 2011 at 15:57, Paolo Carlini  wrote:
> ... are the testcases formatted according to the GNU guidelines

They weren't.  I've run indent -gnu on all of them.  Thanks for noticing.


Diego.


Re: [libffi] Provide unwind info for Tru64 UNIX in osf.S

2011-04-28 Thread Richard Henderson
On 04/28/2011 10:55 AM, Rainer Orth wrote:
> I cannot test the Alpha/Linux side, though.

Neither can I, at the moment.

> 2011-04-28  Rainer Orth  
> 
>   * src/alpha/osf.S (UA_SI, FDE_ENCODING, FDE_ENCODE, FDE_ARANGE):
>   Define.
>   Use them to handle ELF vs. ECOFF differences.
>   [__osf__] (_GLOBAL__F_ffi_call_osf): Define.

Looks good.  If there are any hidden Linux problems, we can
fix them up with another patch.


r~


Re: Here is an updated patch. (issue4438079)

2011-04-28 Thread Xinliang David Li
Introducing the parameters for FDO allows FDO specific tunings.   In
general, these parameters are kludges lacking a better way of doing
it. In the long run, we are working on smarter mechanism to make
decisions based on hot program traces and locality regions as well as
information such as uArch differences -- however this mechanism is not
yet in place.

Thanks,

David

On Thu, Apr 28, 2011 at 8:08 AM, Richard Guenther
 wrote:
> On Thu, Apr 28, 2011 at 4:47 PM, Diego Novillo  wrote:
>> On Wed, Apr 27, 2011 at 22:09, Sharad Singhai  wrote:
>>> Hi Diego,
>>>
>>> Thanks for the quick feedback. Here is a an updated version of the patch.
>>>
>>> 2011-04-27  Sharad Singhai  
>>>
>>>        ChangeLog.google-main
>>>        * params.def: Add new parameters to control peeling.
>>>        * tree-ssa-loop-ivcanon.c (try_unroll_loop_completely): Use
>>>        different peeling parameters when profile feedback is available.
>>>        * loop-unroll.c (decide_peel_once_rolling): Ditto.
>>>        (decide_peel_completely): Ditto.
>>>        * doc/invoke.texi: Document new peeling parameters.
>>>
>>>        testsuite/ChangeLog.google-main
>>>        * gcc.dg/vect/O3-vect-pr34223.c: Add new peeling
>>>        parameters.
>>>        * gcc.dg/vect/vect.exp: Allow reading flags in individual
>>>        tests.
>>
>> OK for google/main.
>>
>> Will you be submitting this patch for trunk as well?  If you get it
>> approved for trunk then you will not need to maintain it in
>> google/main :)
>
> The doc change looks weird, you should have separate entries and
> not combine them.  Checking just for profile_info != NULL is bogus,
> please instead check profile_status == PROFILE_READ.
>
> Did you do any measurements to decide on the param defaults?
> Parameter defaults should be documented.  Did you consider
> adding a single parameter that scales the existing parameters for
> hot loops with profile-feedback?
>
> Richard.
>
>> Diego.
>>
>


[PATCH, committed, 4.6] Backport some recent powerpc patches from trunk to GCC 4.6

2011-04-28 Thread Michael Meissner
I just backported the following patches from the trunk to the GCC 4.6 branch
and committed them after doing a bootstrap and make check with no regressions.

[gcc]
2011-04-28  Michael Meissner  

Backport from mainline
2011-04-01  Andrew Pinski  
Michael Meissner  

PR target/48262
* config/rs6000/vector.md (movmisalign): Allow for memory
operands, as per the specifications.

* config/rs6000/altivec.md (vec_extract_evenv4si): Correct modes.
(vec_extract_evenv4sf): Ditto.
(vec_extract_evenv8hi): Ditto.
(vec_extract_evenv16qi): Ditto.
(vec_extract_oddv4si): Ditto.

[libcpp]
2011-04-28  Michael Meissner  

Backport from mainline
2011-03-18  Michael Meissner  

PR preprocessor/48192
* directives.c (do_ifdef): Do not consider conditional macros as
being defined.
(do_ifndef): Ditto.
* expr.c (parse_defined): Ditto.

[gcc/testsuite]
2011-04-28  Michael Meissner  

Backport from mainline
2011-03-22  Michael Meissner  

* gcc.dg/torture/vector-1.c: On powerpc add -fabi=altivec to avoid
failure on 32-bit systems.
* gcc.dg/torture/vector-2.c: Ditto.

Backport from mainline
2011-03-21  Michael Meissner  

* gcc.dg/torture/va-arg-25.c: Add -mabi=altivec -maltivec for
powerpc.

PR target/48226
* gcc.target/powerpc/pr48226.c: New file.


-- 
Michael Meissner, IBM
5 Technology Place Drive, M/S 2757, Westford, MA 01886-3141, USA
meiss...@linux.vnet.ibm.com fax +1 (978) 399-6899
Index: gcc/testsuite/gcc.dg/torture/va-arg-25.c
===
--- gcc/testsuite/gcc.dg/torture/va-arg-25.c(revision 173136)
+++ gcc/testsuite/gcc.dg/torture/va-arg-25.c(working copy)
@@ -3,6 +3,8 @@
 /* { dg-do run } */
 /* { dg-options "-msse" { target { i?86-*-* x86_64-*-* } } } */
 /* { dg-require-effective-target sse_runtime { target { i?86-*-* x86_64-*-* } 
} } */
+/* { dg-options "-mabi=altivec -maltivec" { target { powerpc-*-* powerpc64-*-* 
} } } */
+/* { dg-require-effective-target vmx_hw { target { powerpc-*-* powerpc64--*-* 
} } } */
 
 #include 
 #include 
Index: gcc/testsuite/gcc.dg/torture/vector-1.c
===
--- gcc/testsuite/gcc.dg/torture/vector-1.c (revision 173136)
+++ gcc/testsuite/gcc.dg/torture/vector-1.c (working copy)
@@ -3,6 +3,8 @@
 /* { dg-do run } */
 /* { dg-options "-msse" { target { i?86-*-* x86_64-*-* } } } */
 /* { dg-require-effective-target sse_runtime { target { i?86-*-* x86_64-*-* } 
} } */
+/* { dg-options "-mabi=altivec" { target { powerpc-*-* powerpc64-*-* } } } */
+/* { dg-require-effective-target vmx_hw { target { powerpc-*-* powerpc64--*-* 
} } } */
 
 #define vector __attribute__((vector_size(16) ))
 
Index: gcc/testsuite/gcc.dg/torture/vector-2.c
===
--- gcc/testsuite/gcc.dg/torture/vector-2.c (revision 173136)
+++ gcc/testsuite/gcc.dg/torture/vector-2.c (working copy)
@@ -3,6 +3,8 @@
 /* { dg-do run } */
 /* { dg-options "-msse" { target { i?86-*-* x86_64-*-* } } } */
 /* { dg-require-effective-target sse_runtime { target { i?86-*-* x86_64-*-* } 
} } */
+/* { dg-options "-mabi=altivec" { target { powerpc-*-* powerpc64-*-* } } } */
+/* { dg-require-effective-target vmx_hw { target { powerpc-*-* powerpc64--*-* 
} } } */
 
 #define vector __attribute__((vector_size(16) ))
 
Index: gcc/config/rs6000/vector.md
===
--- gcc/config/rs6000/vector.md (revision 173136)
+++ gcc/config/rs6000/vector.md (working copy)
@@ -872,8 +872,8 @@ (define_expand "vec_realign_load_"
 ;; Under VSX, vectors of 4/8 byte alignments do not need to be aligned
 ;; since the load already handles it.
 (define_expand "movmisalign"
- [(set (match_operand:VEC_N 0 "vfloat_operand" "")
-   (match_operand:VEC_N 1 "vfloat_operand" ""))]
+ [(set (match_operand:VEC_N 0 "nonimmediate_operand" "")
+   (match_operand:VEC_N 1 "any_operand" ""))]
  "VECTOR_MEM_VSX_P (mode) && TARGET_ALLOW_MOVMISALIGN"
  "")
 
Index: gcc/config/rs6000/altivec.md
===
--- gcc/config/rs6000/altivec.md(revision 173136)
+++ gcc/config/rs6000/altivec.md(working copy)
@@ -2430,7 +2430,7 @@ (define_insn "altivec_stvrxl"
 
 (define_expand "vec_extract_evenv4si"
  [(set (match_operand:V4SI 0 "register_operand" "")
-(unspec:V8HI [(match_operand:V4SI 1 "register_operand" "")
+(unspec:V4SI [(match_operand:V4SI 1 "register_operand" "")
   (match_operand:V4SI 2 "register_operand" "")]
  UNSPEC_EXTEVEN_V4SI))]
   "TARGET_ALTIVEC"
@@ -2463,7 +2463,7 @@ (define_expand "vec_extract_evenv4si"
 
 (define_expand "vec_extract_evenv4sf"
  [(set (match_opera

[C++ Patch] PR 48606

2011-04-28 Thread Paolo Carlini

Hi,

a small patch for a [4.7 Regression] ICE on invalid: apparently, as 
happens in other places in the same file, we want to check here too the 
return value of build_value_init for error_mark_node and bail out.


Tested x86_64-linux. Ok?

Thanks,
Paolo.

//
/cp
2011-04-29  Paolo Carlini  

PR c++/48606
* init.c (perform_member_init): Check build_value_init return
value for error_mark_node.

/testsuite
2011-04-29  Paolo Carlini  

PR c++/48606
* g++.dg/init/ctor10.C: New.
Index: testsuite/g++.dg/init/ctor10.C
===
--- testsuite/g++.dg/init/ctor10.C  (revision 0)
+++ testsuite/g++.dg/init/ctor10.C  (revision 0)
@@ -0,0 +1,9 @@
+// PR c++/48606
+// { dg-do compile }
+// { dg-options "-fkeep-inline-functions" }
+
+struct S
+{
+  int &ref;
+  S() : ref() {};  // { dg-error "value-initialization of" }
+};
Index: cp/init.c
===
--- cp/init.c   (revision 173136)
+++ cp/init.c   (working copy)
@@ -513,8 +513,10 @@ perform_member_init (tree member, tree init)
}
   else
{
- init = build2 (INIT_EXPR, type, decl,
-build_value_init (type, tf_warning_or_error));
+ tree value = build_value_init (type, tf_warning_or_error);
+ if (value == error_mark_node)
+   return;
+ init = build2 (INIT_EXPR, type, decl, value);
  finish_expr_stmt (init);
}
 }


[Patch, Fortran] Fix regressions PRs 48810 and 48800: wrong access flag and missing deferred-shape diagnostics

2011-04-28 Thread Tobias Burnus

The attached patch fixes two regressions:

a) PR 48810: For type-bound procedures, the access flags should be 
checked only for the generic function, not for the specific function the 
generic resolves to. (4.6/4.7 rejects-valid regression.)


b) PR 48800: Function-results shall not be assumed-shape arrays, unless 
they are allocatable or a pointer. gfortran was missing a diagnostic for 
that. (The diagnostic never existed, but with 4.6/4.7 it now ICEs as 
realloc on assignment does not like it.)


Build and regtested on x86-64-linux.
OK for the trunk and the 4.6 branch?

Tobias

PS: We still have 4 other 4.6/4.7 regressions (+ the CPP target one). 
Two of them are true realloc-on-assignment bugs (PRs 42954 and 48746; 
wrong code). One is an OOP bug (PR 48786; rejects valid + ICE on invalid 
code), the other one is a tree-check bug (ICE) related to "restrict". -- 
As written before, we should try hard to fix all 4.6/4.7 regression 
before 4.6.1 is relased. Cf. http://gcc.gnu.org/ml/gcc/2011-04/msg00349.html
2011-04-28  Tobias Burnus  

	PR fortran/48810
	* resolve.c (resolve_typebound_generic_call): Don't check access
	flags of the specific function.

	PR fortran/48800
	* resolve.c (resolve_formal_arglist): Don't change AS_DEFERRED
	to AS_ASSUMED_SHAPE for function results.
	(resolve_fl_var_and_proc): Print also for function results with
	AS_DEFERRED an error, if they are not a pointer or allocatable.
	(resolve_types): Make sure arguments of procedures in interface
	blocks are resolved.

2011-04-28  Tobias Burnus  

	PR fortran/48810
	* gfortran.dg/typebound_proc_22.f90: New.

	PR fortran/48800
	* gfortran.dg/interface_36.f90: New.

--- /dev/null	2011-04-28 20:20:21.287889577 +0200
+++ gcc/gcc/testsuite/gfortran.dg/typebound_proc_22.f90	2011-04-28 22:52:39.0 +0200
@@ -0,0 +1,49 @@
+! { dg-do compile }
+!
+! PR fortran/48810
+!
+! Contributed by Andrew Baldwin
+!
+  module qtest
+  type foobar
+integer :: x
+contains
+private
+procedure :: gimmex
+generic, public :: getx => gimmex
+  end type foobar
+  contains
+function gimmex(foo)
+  class (foobar) :: foo
+  integer :: gimmex
+  gimmex = foo%x
+end function gimmex
+  end module qtest
+
+  module qtestPriv
+  type foobarPriv
+integer :: x
+contains
+private
+procedure :: gimmexPriv
+generic, private :: getxPriv => gimmexPriv
+  end type foobarPriv
+  contains
+function gimmexPriv(foo)
+  class (foobarPriv) :: foo
+  integer :: gimmex
+  gimmex = foo%x
+end function gimmexPriv
+  end module qtestPriv
+
+  program quicktest
+  use qtest
+  use qtestPriv
+  type (foobar) :: foo
+  type (foobarPriv) :: fooPriv
+  integer :: bar
+  bar = foo%getx()  ! OK
+  bar = fooPriv%getxPriv() ! { dg-error " is PRIVATE " }
+  end program quicktest
+
+! { dg-final { cleanup-modules "qtest qtestpriv" } }
--- /dev/null	2011-04-28 20:20:21.287889577 +0200
+++ gcc/gcc/testsuite/gfortran.dg/interface_36.f90	2011-04-28 23:27:22.0 +0200
@@ -0,0 +1,28 @@
+! { dg-do compile }
+!
+! PR fortran/48800
+!
+! Contributed by Daniel Carrera
+!
+ pure function runge_kutta_step(t, r_, dr, h) result(res)
+ real, intent(in) :: t, r_(:), h
+ real, dimension(:), allocatable :: k1, k2, k3, k4, res
+ integer :: N
+
+ interface
+ pure function dr(t, r_)  ! { dg-error "cannot have a deferred shape" }
+ real, intent(in) :: t, r_(:)
+ real :: dr(:)
+ end function
+ end interface
+
+ N = size(r_)
+ allocate(k1(N),k2(N),k3(N),k4(N),res(N))
+
+ k1 = dr(t, r_)
+ k2 = dr(t + h/2, r_ + k1*h/2)
+ k3 = dr(t + h/2, r_ + k2*h/2)
+ k4 = dr(t + h  , r_ + k3*h)
+
+ res = r_ + (k1 + 2*k2 + 2*k3 + k4) * h/6
+ end function
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index 7fed7a5..a19b103 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -315,7 +315,8 @@ resolve_formal_arglist (gfc_symbol *proc)
 	 shape until we know if it has the pointer or allocatable attributes.
   */
   if (sym->as && sym->as->rank > 0 && sym->as->type == AS_DEFERRED
-	  && !(sym->attr.pointer || sym->attr.allocatable))
+	  && !(sym->attr.pointer || sym->attr.allocatable)
+	  && sym->attr.flavor != FL_PROCEDURE)
 	{
 	  sym->as->type = AS_ASSUMED_SHAPE;
 	  for (i = 0; i < sym->as->rank; i++)
@@ -5684,7 +5685,7 @@ success:
   /* Make sure that we have the right specific instance for the name.  */
   derived = get_declared_from_expr (NULL, NULL, e);
 
-  st = gfc_find_typebound_proc (derived, NULL, genname, false, &e->where);
+  st = gfc_find_typebound_proc (derived, NULL, genname, true, &e->where);
   if (st)
 e->value.compcall.tbp = st->n.tb;
 
@@ -9918,7 +9919,7 @@ resolve_fl_var_and_proc (gfc_sy

[google] LIPO regression tests and bug fixes (issue4444076)

2011-04-28 Thread David Li
This patch added regression tests for LIPO in google/main and fixes a couple of 
bugs found
in app testing:

1) duplicate assembler labels in .s file
2) missing icall profling for static functions indirect called
3) assertion in type 'merging'
4) gcov-dump bug.

Bootstrap compiler, regression test, and SPEC06 LIPO build.

Will commit to google/main.

Thanks,

David

2011-04-28  David Li  

* testsuite/gcc.dg/tree-prof/lipo/inliner-1.c   (revision 0): New test.
* testsuite/gcc.dg/tree-prof/lipo/gdb_cmd   (revision 0): Ditto.
* testsuite/gcc.dg/tree-prof/lipo/bb-reorg.c(revision 0): Ditto.
* testsuite/gcc.dg/tree-prof/lipo/stringop-1.c  (revision 0): Ditto.
* testsuite/gcc.dg/tree-prof/lipo/pr34999.c (revision 0): Ditto.
* testsuite/gcc.dg/tree-prof/lipo/stringop-2.c  (revision 0): Ditto.
* testsuite/gcc.dg/tree-prof/lipo/update-loopch.c   (revision 0):
* 
testsuite/gcc.dg/tree-prof/lipo/indir-call-prof.c.040i.tree_profile_ipa   
(revision 0):
Ditto.
* testsuite/gcc.dg/tree-prof/lipo/ic-misattribution-1.c (revision 0): 
Ditto.
* testsuite/gcc.dg/tree-prof/lipo/update-tailcall.c (revision 0): 
Ditto.
* testsuite/gcc.dg/tree-prof/lipo/ic-misattribution-1a.c
(revision 0): Ditto.
* testsuite/gcc.dg/tree-prof/lipo/lipo.exp  (revision 0): Ditto.
* testsuite/gcc.dg/tree-prof/lipo/tracer-1.c(revision 0): Ditto.
* testsuite/gcc.dg/tree-prof/lipo/indir-call-prof.c.145t.optimized  
(revision 0): Ditto.
* testsuite/gcc.dg/tree-prof/lipo/indir-call-prof.c (revision 0): 
Ditto.
* testsuite/gcc.dg/tree-prof/lipo/val-prof-1.c  (revision 0): Ditto.
* testsuite/gcc.dg/tree-prof/lipo/wcoverage-mismatch.c  (revision 0): 
Ditto.
* testsuite/gcc.dg/tree-prof/lipo/val-prof-2.c  (revision 0): Ditto.
* testsuite/gcc.dg/tree-prof/lipo/pr45354.c (revision 0): Ditto.
* testsuite/gcc.dg/tree-prof/lipo/val-prof-3.c  (revision 0): Ditto.
* testsuite/gcc.dg/tree-prof/lipo/val-prof-4.c  (revision 0): Ditto.
* testsuite/gcc.dg/tree-prof/lipo/val-prof-5.c  (revision 0): Ditto.
* testsuite/gcc.dg/tree-prof/lipo/val-prof-6.c  (revision 0): Ditto.
* testsuite/gcc.dg/tree-prof/lipo/val-prof-7.c  (revision 0): Ditto.
* testsuite/gcc.dg/tree-prof/lipo/pr47187.c (revision 0): Ditto.
* testsuite/gcc.dg/tree-prof/lipo/update-cunroll-2.c(revision 0): 
Ditto.
* testsuite/g++.dg/tree-prof/lipo/inline_mismatch_args.C
(revision 0): Ditto.
* testsuite/g++.dg/tree-prof/lipo/indir-call-prof-2.C   (revision 0): 
Ditto.
* testsuite/g++.dg/tree-prof/lipo/indir-call-prof.C (revision 0): 
Ditto.
* testsuite/g++.dg/tree-prof/lipo/partition1.C  (revision 0): Ditto.
* testsuite/g++.dg/tree-prof/lipo/partition2.C  (revision 0): Ditto.
* testsuite/g++.dg/tree-prof/lipo/partition3.C  (revision 0): Ditto.
* testsuite/g++.dg/tree-prof/lipo/lipo.exp  (revision 0): Ditto.
* final.c   (revision 173136) (profile_function): Use FUNC_LABEL_ID.
* dwarf2out.c   (revision 173136) (dwarf2out_vms_end_prologue): Ditto.
(dwarf2out_vms_begin_epilogue): Ditto.
(dwarf2out_vms_debug_main_pointer): Ditto.
* cgraphunit.c  (revision 173136) (cgraph_finalize_compilation_unit):
Remove eq type alias set computation.
* tree-profile.c(revision 173136) (gimple_gen_ic_func_profiler):
(gimple_gen_ic_func_topn_profiler): Do not skip any functions.
(tree_profiling): Add type alias merging.
* l-ipo.c   (revision 173136) (restore_post_parsing_states): Use
max funcdef_no.
(pop_module_scope): Use max funcdef_no.
* gcov-dump.c   (revision 173136) (tag_function): Fix a bug in function
read.

Index: final.c
===
--- final.c (revision 173136)
+++ final.c (working copy)
@@ -1623,7 +1623,7 @@ profile_function (FILE *file ATTRIBUTE_U
   int align = MIN (BIGGEST_ALIGNMENT, LONG_TYPE_SIZE);
   switch_to_section (data_section);
   ASM_OUTPUT_ALIGN (file, floor_log2 (align / BITS_PER_UNIT));
-  targetm.asm_out.internal_label (file, "LP", current_function_funcdef_no);
+  targetm.asm_out.internal_label (file, "LP", FUNC_LABEL_ID (cfun));
   assemble_integer (const0_rtx, LONG_TYPE_SIZE / BITS_PER_UNIT, align, 1);
 }
 
@@ -1636,7 +1636,7 @@ profile_function (FILE *file ATTRIBUTE_U
 ASM_OUTPUT_REG_PUSH (file, REGNO (chain));
 #endif
 
-  FUNCTION_PROFILER (file, current_function_funcdef_no);
+  FUNCTION_PROFILER (file, FUNC_LABEL_ID (cfun));
 
 #ifdef ASM_OUTPUT_REG_PUSH
   if (chain && REG_P (chain))
Index: cgraphunit.c
===
--- cgraphunit.c(revision 173136)
+++ cgraphunit.c

Re: Disable tracer by default for profile use (issue4428074)

2011-04-28 Thread Richard Guenther
On Thu, Apr 28, 2011 at 8:53 PM, Diego Novillo  wrote:
> On Thu, Apr 28, 2011 at 14:51, Sharad Singhai  wrote:
>> This patch disables -ftracer for profile use. Okay for google/main?
>
> Could you elaborate on why doing this is beneficial?  Are you
> proposing this for trunk as well?

It indeed doesn't make sense to me at all.

Richard.

>> 2011-04-28  Sharad Singhai  
>>
>>        Google Ref 40087
>>        * opts.c (common_handle_option): Disable -ftracer for profile use.
>>        * doc/invoke.texi: Update doc that -ftracer is no longer enabled for 
>> FDO.
>
> OK.
>
>
> Diego.
>


Re: [google] Add -fstrict-enum-precision flag (issue4433083)

2011-04-28 Thread Richard Guenther
On Thu, Apr 28, 2011 at 9:50 PM, Diego Novillo  wrote:
>
> This patch from Silvius Rus adds a new flag (-fstrict-enum-precision).
> While porting the patch to 4.6, I noticed that the C++ FE now has a
> similar flag that seems to have similar semantics (-fstrict-enums).
>
> Silvius's patch is used to disable some switch() optimizations that
> assume enum types can *only* take values within that enum (Silvius,
> please correct me if I got this wrong).
>
> Jason, your -fstrict-enums only applies to the C++ front end.
> Silvius's variant affects VRP and gimplification of switches.  Would
> it be better if we simply moved -fstrict-enums to common options and
> used that to decide whether to optimize switches in VRP and the
> gimplifier?

I think only the C++ frontend suffers from the "problem".  See also
the patch to disable use of this kind of info from VRP.

Richard.

> We use it internally to disable this optimization for code that
> generates values outside of enum ranges.
>
> Committed to google/main.  Jason, Silvius, what do you think would be
> the best approach to merge this into trunk?
>
> Thanks.  Diego.
>
> 2011-04-27  Silvius Rus  
>
>        * doc/invoke.texi (fno-strict-enum-precision): Document.
>        * gimplify.c (gimplify_switch_expr): If
>        -fno-strict-enum-precision is given, do not consider enum
>        types.
>        * tree-vrp.c (stmt_interesting_for_vrp): If
>        -fno-strict-enum-precision is given, do not look at enum
>        types.
>
> 2011-04-27  Silvius Rus  
>
>        * g++.dg/other/no-strict-enum-precision-1.C: New.
>        * g++.dg/other/no-strict-enum-precision-2.C: New.
>        * g++.dg/other/no-strict-enum-precision-3.C: New.
>
> diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
> index cb04d91..cffc70d 100644
> --- a/gcc/doc/invoke.texi
> +++ b/gcc/doc/invoke.texi
> @@ -393,8 +393,8 @@ Objective-C and Objective-C++ Dialects}.
>  -fsel-sched-pipelining -fsel-sched-pipelining-outer-loops @gol
>  -fsignaling-nans -fsingle-precision-constant -fsplit-ivs-in-unroller @gol
>  -fsplit-wide-types -fstack-protector -fstack-protector-all @gol
> --fstrict-aliasing -fstrict-overflow -fthread-jumps -ftracer @gol
> --ftree-bit-ccp @gol
> +-fstrict-aliasing -fstrict-overflow -fno-strict-enum-precision -fthread-jumps
> +-ftracer -ftree-bit-ccp @gol
>  -ftree-builtin-call-dce -ftree-ccp -ftree-ch -ftree-copy-prop @gol
>  -ftree-copyrename -ftree-dce -ftree-dominator-opts -ftree-dse @gol
>  -ftree-forwprop -ftree-fre -ftree-loop-if-convert @gol
> @@ -2073,6 +2073,11 @@ represented in the minimum number of bits needed to 
> represent all the
>  enumerators).  This assumption may not be valid if the program uses a
>  cast to convert an arbitrary integer value to the enumeration type.
>
> +@item -fno-strict-enum-precision
> +@opindex fno-strict-enum-precision
> +Do not perform optimizations of switch() statements based on the
> +precision of enum types.
> +
>  @item -ftemplate-depth=@var{n}
>  @opindex ftemplate-depth
>  Set the maximum instantiation depth for template classes to @var{n}.
> diff --git a/gcc/gimplify.c b/gcc/gimplify.c
> index 83eaedc..8984d39 100644
> --- a/gcc/gimplify.c
> +++ b/gcc/gimplify.c
> @@ -1602,6 +1602,8 @@ gimplify_switch_expr (tree *expr_p, gimple_seq *pre_p)
>            type = TREE_TYPE (SWITCH_COND (switch_expr));
>          if (len
>              && INTEGRAL_TYPE_P (type)
> +              && (flag_strict_enum_precision
> +                  || TREE_CODE (type) != ENUMERAL_TYPE)
>              && TYPE_MIN_VALUE (type)
>              && TYPE_MAX_VALUE (type)
>              && tree_int_cst_equal (CASE_LOW (VEC_index (tree, labels, 0)),
> diff --git a/gcc/testsuite/g++.dg/other/no-strict-enum-precision-1.C 
> b/gcc/testsuite/g++.dg/other/no-strict-enum-precision-1.C
> new file mode 100644
> index 000..87f263c
> --- /dev/null
> +++ b/gcc/testsuite/g++.dg/other/no-strict-enum-precision-1.C
> @@ -0,0 +1,22 @@
> +/* { dg-do run } */
> +/* { dg-options "-fno-strict-enum-precision" } */
> +
> +enum zero_one { zero = 0, one = 1 };
> +
> +int* allocate_bool(zero_one e) {
> +  int* v = 0;
> +  switch (e) {
> +    case zero: v = new int(0);
> +    case one: v = new int(1);
> +  }
> +  return v;
> +}
> +
> +int main() {
> +  if (allocate_bool(static_cast(999))) {
> +    /* Error: should not have matched any case label.  */
> +    return 1;
> +  } else {
> +    return 0;
> +  }
> +}
> diff --git a/gcc/testsuite/g++.dg/other/no-strict-enum-precision-2.C 
> b/gcc/testsuite/g++.dg/other/no-strict-enum-precision-2.C
> new file mode 100644
> index 000..5b6af17
> --- /dev/null
> +++ b/gcc/testsuite/g++.dg/other/no-strict-enum-precision-2.C
> @@ -0,0 +1,26 @@
> +/* { dg-do run } */
> +/* { dg-options "-O2 -fno-strict-enum-precision" } */
> +
> +enum X {
> +  X1,
> +  X2
> +};
> +
> +int foo (enum X x) {
> +  switch (x) {
> +    case X1:
> +      return 0;
> +    case X2:
> +      return 1;
> +  }
> +  return x;
> +}
> +
> +int main(int argc, char *argv[]) {

Re: Disable tracer by default for profile use (issue4428074)

2011-04-28 Thread Xinliang David Li
Sharad can provide some some performance data -- we have seen up to 2%
degradation to with tracer turned on for one of google's most
important program. Perhaps Sharad can collect some SPEC numbers.

I agree a better approach should be to fix the problem in tracer
instead of turning it off in trunk.

David


On Thu, Apr 28, 2011 at 4:23 PM, Richard Guenther
 wrote:
> On Thu, Apr 28, 2011 at 8:53 PM, Diego Novillo  wrote:
>> On Thu, Apr 28, 2011 at 14:51, Sharad Singhai  wrote:
>>> This patch disables -ftracer for profile use. Okay for google/main?
>>
>> Could you elaborate on why doing this is beneficial?  Are you
>> proposing this for trunk as well?
>
> It indeed doesn't make sense to me at all.
>
> Richard.
>
>>> 2011-04-28  Sharad Singhai  
>>>
>>>        Google Ref 40087
>>>        * opts.c (common_handle_option): Disable -ftracer for profile use.
>>>        * doc/invoke.texi: Update doc that -ftracer is no longer enabled for 
>>> FDO.
>>
>> OK.
>>
>>
>> Diego.
>>
>


Re: Disable tracer by default for profile use (issue4428074)

2011-04-28 Thread Richard Guenther
On Fri, Apr 29, 2011 at 1:34 AM, Xinliang David Li  wrote:
> Sharad can provide some some performance data -- we have seen up to 2%
> degradation to with tracer turned on for one of google's most
> important program. Perhaps Sharad can collect some SPEC numbers.
>
> I agree a better approach should be to fix the problem in tracer
> instead of turning it off in trunk.

Esp. not turning it off for profile-use only where it should have the most
precise input.

Richard.

> David
>
>
> On Thu, Apr 28, 2011 at 4:23 PM, Richard Guenther
>  wrote:
>> On Thu, Apr 28, 2011 at 8:53 PM, Diego Novillo  wrote:
>>> On Thu, Apr 28, 2011 at 14:51, Sharad Singhai  wrote:
 This patch disables -ftracer for profile use. Okay for google/main?
>>>
>>> Could you elaborate on why doing this is beneficial?  Are you
>>> proposing this for trunk as well?
>>
>> It indeed doesn't make sense to me at all.
>>
>> Richard.
>>
 2011-04-28  Sharad Singhai  

        Google Ref 40087
        * opts.c (common_handle_option): Disable -ftracer for profile use.
        * doc/invoke.texi: Update doc that -ftracer is no longer enabled 
 for FDO.
>>>
>>> OK.
>>>
>>>
>>> Diego.
>>>
>>
>


[google]Add support for sampled profile collection (issue4438083)

2011-04-28 Thread Easwaran Raman
This patch from Silvius Rus  adds support for sampled edge profile collection 
to reduce instrumentation run overhead. Bootstraps and no test regressions. Ok 
for google/main?

2011-04-28  Silvius Rus  

* doc/invoke.texi: Document -fprofile-generate-sampling option.
* gcov-io.h (__gcov_set_sampling_rate): New declaration.
* profile.c (branch_prob): Add support for sampled profile
collection.
* profile.h (add_sampling_to_edge_counters): New declaration.
* common.opt (fprofile-generate-sampling): New option.
* tree-profile: Include header files; define EDGE_COUNTER_STMT_COUNT.
(instrumentation_to_be_sampled, gcov_sample_counter_decl)
(gcov_sampling_rate_decl): New globals.
(insert_if_then, add_sampling_wrapper, is_instrumentation_to_be_sampled)
(add_sampling_to_edge_counters, gimple_init_instrumentation_sampling):
New functions.
(gimple_init_edge_profiler): Call gimple_init_instrumentation_sampling.
(gimple_gen_edge_profiler): Mark start of instrumentation block.
* libgcov.c (__gcov_sampling_rate): New extern declaration.
(gcov_sampling_rate_initialized, __gcov_sample_counter): New globals.
(gcov_exit): Set sampling rate; minor coding style fixes.
* params.def (PARAM_PROFILE_GENERATE_SAMPLING_RATE): New parameter.

Index: gcc/doc/invoke.texi
===
--- gcc/doc/invoke.texi (revision 173136)
+++ gcc/doc/invoke.texi (working copy)
@@ -375,7 +375,7 @@ Objective-C and Objective-C++ Dialects}.
 -fpartial-inlining -fpeel-loops -fpredictive-commoning @gol
 -fprefetch-loop-arrays @gol
 -fprofile-correction -fprofile-dir=@var{path} -fprofile-generate @gol
--fprofile-generate=@var{path} @gol
+-fprofile-generate=@var{path} -fprofile-generate-sampling @gol
 -fprofile-use -fprofile-use=@var{path} -fprofile-values @gol
 -freciprocal-math -fregmove -frename-registers -freorder-blocks @gol
 -freorder-blocks-and-partition -freorder-functions @gol
@@ -7923,6 +7923,20 @@ The following options are enabled: @code{-fprofile
 If @var{path} is specified, GCC will look at the @var{path} to find
 the profile feedback data files. See @option{-fprofile-dir}.
 
+@item -fprofile-generate-sampling
+@opindex -fprofile-generate-sampling
+
+Enable sampling for instrumented binaries.  Instead of recording every event,
+record only every N-th event, where N (the sampling rate) can be set either
+at compile time using
+@option{--param profile-generate-sampling-rate=@var{value}}, or
+at execution start time through environment variable @samp{GCOV_SAMPLING_RATE}.
+
+At this time sampling applies only to branch counters.  A sampling rate of 100
+decreases instrumentated binary slowdown from up to 20x for heavily threaded
+applications down to around 2x.  @option{-fprofile-correction} is always
+needed with sampling.
+
 @item -fprofile-use
 @itemx -fprofile-use=@var{path}
 @opindex fprofile-use
@@ -9138,6 +9152,9 @@ recognize.
 If you want to pass an option that takes an argument, you must use
 @option{-Xassembler} twice, once for the option and once for the argument.
 
+@item profile-generate-sampling-rate
+Set the sampling rate with @option{-fprofile-generate-sampling}.
+
 @end table
 
 @node Link Options
Index: gcc/gcov-io.h
===
--- gcc/gcov-io.h   (revision 173136)
+++ gcc/gcov-io.h   (working copy)
@@ -544,6 +544,9 @@ struct dyn_imp_mod
 /* Register a new object file module.  */
 extern void __gcov_init (struct gcov_info *) ATTRIBUTE_HIDDEN;
 
+/* Set sampling rate to RATE.  */
+extern void __gcov_set_sampling_rate (unsigned int rate);
+
 /* Called before fork, to avoid double counting.  */
 extern void __gcov_flush (void) ATTRIBUTE_HIDDEN;
 
Index: gcc/profile.c
===
--- gcc/profile.c   (revision 173136)
+++ gcc/profile.c   (working copy)
@@ -1210,6 +1210,9 @@ branch_prob (void)
 
   /* Commit changes done by instrumentation.  */
   gsi_commit_edge_inserts ();
+
+  if (flag_profile_generate_sampling)
+add_sampling_to_edge_counters ();
 }
 
   free_aux_for_edges ();
Index: gcc/profile.h
===
--- gcc/profile.h   (revision 173136)
+++ gcc/profile.h   (working copy)
@@ -47,4 +47,10 @@ extern gcov_type sum_edge_counts (VEC (edge, gc) *
 extern void init_node_map (void);
 extern void del_node_map (void);
 
+/* Implement sampling to avoid writing to edge counters very often.
+   Many concurrent writes to the same counters, or to counters that share
+   the same cache line leads to up to 30x slowdown on an application running
+   on 8 CPUs.  With sampling, the slowdown reduced to 2x.  */
+extern void add_sampling_to_edge_counters (void);
+
 #endif /* PROFILE_H */
Index: gcc/common.opt
===

Re: Disable tracer by default for profile use (issue4428074)

2011-04-28 Thread Xinliang David Li
Tracer is not turned on by default for non-FDO case -- Sharad's change
simply turns it off by default for all cases.

David

On Thu, Apr 28, 2011 at 4:38 PM, Richard Guenther
 wrote:
> On Fri, Apr 29, 2011 at 1:34 AM, Xinliang David Li  wrote:
>> Sharad can provide some some performance data -- we have seen up to 2%
>> degradation to with tracer turned on for one of google's most
>> important program. Perhaps Sharad can collect some SPEC numbers.
>>
>> I agree a better approach should be to fix the problem in tracer
>> instead of turning it off in trunk.
>
> Esp. not turning it off for profile-use only where it should have the most
> precise input.
>
> Richard.
>
>> David
>>
>>
>> On Thu, Apr 28, 2011 at 4:23 PM, Richard Guenther
>>  wrote:
>>> On Thu, Apr 28, 2011 at 8:53 PM, Diego Novillo  wrote:
 On Thu, Apr 28, 2011 at 14:51, Sharad Singhai  wrote:
> This patch disables -ftracer for profile use. Okay for google/main?

 Could you elaborate on why doing this is beneficial?  Are you
 proposing this for trunk as well?
>>>
>>> It indeed doesn't make sense to me at all.
>>>
>>> Richard.
>>>
> 2011-04-28  Sharad Singhai  
>
>        Google Ref 40087
>        * opts.c (common_handle_option): Disable -ftracer for profile use.
>        * doc/invoke.texi: Update doc that -ftracer is no longer enabled 
> for FDO.

 OK.


 Diego.

>>>
>>
>


Avoid global state in m68k_handle_option

2011-04-28 Thread Joseph S. Myers
This patch stops m68k_handle_option from using global state.  The
general approach is similar to that used for ARM: new .def files are
added for the -march= and -mtune= arguments, to go along with the
existing one for -mcpu= arguments, and as well as initializing arrays
in m68k.c these are used to generate a .opt file with the relevant
Enum entries.  Thus gcc_options fields are set automatically from the
arguments to these three options, and m68k_option_override then sets
the resulting pointers (some of which could actually become local
variables in m68k_option_override because they are not used
elsewhere).

The enum uarch_type enumeration now gets its contents from
m68k-microarchs.def; enum target_device already got its contents from
m68k-devices.def.  (Note that the ucfv5 value does not correspond to
any entry in any of the tables, so the code using it is in fact dead.)
The isa_* enum values do not have a one-to-one correspondence with
entries in m68k-isas.def, so that enum still has its values defined
manually and the option uses int values as indices into the table.

Tested building cc1 and xgcc for cross to m68k-elf.  Will commit to
trunk in the absence of target maintainer objections.

contrib:
2011-04-28  Joseph Myers  

* gcc_update (gcc/config/m68k/m68k-tables.opt): New dependencies.

gcc:
2011-04-28  Joseph Myers  

* config/m68k/genopt.sh, config/m68k/m68k-isas.def,
config/m68k/m68k-microarchs.def, config/m68k/m68k-opts.h,
config/m68k/t-opts: New files.
* config/m68k/m68k-tables.opt: New file (generated).
* config.gcc (fido-*-*, m68k-*-*): Add m68k/m68k-tables.opt to
extra_options and m68k/t-opts to tmake_file.
* config/m68k/m68k.c (m68k_library_id_string): More to m68k.opt.
(all_isas): Initialize using m68k-isas.def.
(all_microarchs): Initialize using m68k-microarchs.def.
(m68k_find_selection): Remove.
(m68k_handle_option): Don't assert that global structures are in
use.  Use error_at.  Access variables via opts pointer.  Don't
handle -march=, -mcpu= and -mtune= here.  Set gcc_options fields
directly for -m68020-40 and -m68020-60.
(m68k_option_override): Set m68k_arch_entry, m68k_cpu_entry and
m68k_tune_entry here.
* config/m68k/m68k.h (enum uarch_type, enum target_device): Move
to m68k-opts.h.
(m68k_library_id_string): Remove declaration.
* config/m68k/m68k.opt (config/m68k/m68k-opts.h): New
HeaderInclude.
(m68k_library_id_string): New Variable.
(march=, mcpu=, mtune=): Use Enum and Var.

Index: contrib/gcc_update
===
--- contrib/gcc_update  (revision 173046)
+++ contrib/gcc_update  (working copy)
@@ -81,6 +81,7 @@ gcc/config.in: gcc/cstamp-h.in
 gcc/fixinc/fixincl.x: gcc/fixinc/fixincl.tpl gcc/fixinc/inclhack.def
 gcc/config/arm/arm-tune.md: gcc/config/arm/arm-cores.def 
gcc/config/arm/gentune.sh
 gcc/config/arm/arm-tables.opt: gcc/config/arm/arm-arches.def 
gcc/config/arm/arm-cores.def gcc/config/arm/genopt.sh
+gcc/config/m68k/m68k-tables.opt: gcc/config/m68k/m68k-devices.def 
gcc/config/m68k/m68k-isas.def gcc/config/m68k/m68k-microarchs.def 
gcc/config/m68k/genopt.sh
 # And then, language-specific files
 gcc/cp/cfns.h: gcc/cp/cfns.gperf
 gcc/java/keyword.h: gcc/java/keyword.gperf
Index: gcc/config.gcc
===
--- gcc/config.gcc  (revision 173046)
+++ gcc/config.gcc  (working copy)
@@ -317,6 +317,7 @@ moxie*) cpu_type=moxie
 fido-*-*)
cpu_type=m68k
extra_headers=math-68881.h
+   extra_options="${extra_options} m68k/m68k-tables.opt"
 ;;
 i[34567]86-*-*)
cpu_type=i386
@@ -360,6 +361,7 @@ m32r*-*-*)
 ;;
 m68k-*-*)
extra_headers=math-68881.h
+   extra_options="${extra_options} m68k/m68k-tables.opt"
;;
 microblaze*-*-*)
 cpu_type=microblaze
@@ -3524,6 +3526,7 @@ case ${target} in
 
fido*-*-* | m68k*-*-*)
target_cpu_default2=$m68k_cpu_ident
+   tmake_file="m68k/t-opts $tmake_file"
if [ x"$m68k_arch_family" != x ]; then
tmake_file="m68k/t-$m68k_arch_family $tmake_file"
fi
Index: gcc/config/m68k/m68k-isas.def
===
--- gcc/config/m68k/m68k-isas.def   (revision 0)
+++ gcc/config/m68k/m68k-isas.def   (revision 0)
@@ -0,0 +1,43 @@
+/* m68k ISA names.
+   Copyright (C) 1987, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
+   2001, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
+   Free Software Foundation, Inc.
+
+   This file is part of GCC.
+
+   GCC is free software; you can redistribute it and/or modify it
+   under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3, or (at your opt

Re: [google]Add support for sampled profile collection (issue4438083)

2011-04-28 Thread Xinliang David Li
+ Honza

This patch may be a candidate for trunk as well. This feature not only
allows profile collection with much less overhead (for multi-thread
programs with hot regions, the slow down can be significant due to
cache ping-pong effect of counter update) without sacrificing too much
the performance.

Another usage for this support is that it allows profile collection to
be turned on/off asynchronously for long running server programs which
sometimes profile data in warm up period is not important and should
be excluded.

A known limitation is that value profiling is not yet sampled, but it
does not seem to cause problems.

David



On Thu, Apr 28, 2011 at 4:42 PM, Easwaran Raman  wrote:
> This patch from Silvius Rus  adds support for sampled edge profile collection 
> to reduce instrumentation run overhead. Bootstraps and no test regressions. 
> Ok for google/main?
>
> 2011-04-28  Silvius Rus  
>
>        * doc/invoke.texi: Document -fprofile-generate-sampling option.
>        * gcov-io.h (__gcov_set_sampling_rate): New declaration.
>        * profile.c (branch_prob): Add support for sampled profile
>        collection.
>        * profile.h (add_sampling_to_edge_counters): New declaration.
>        * common.opt (fprofile-generate-sampling): New option.
>        * tree-profile: Include header files; define EDGE_COUNTER_STMT_COUNT.
>        (instrumentation_to_be_sampled, gcov_sample_counter_decl)
>        (gcov_sampling_rate_decl): New globals.
>        (insert_if_then, add_sampling_wrapper, 
> is_instrumentation_to_be_sampled)
>        (add_sampling_to_edge_counters, gimple_init_instrumentation_sampling):
>        New functions.
>        (gimple_init_edge_profiler): Call gimple_init_instrumentation_sampling.
>        (gimple_gen_edge_profiler): Mark start of instrumentation block.
>        * libgcov.c (__gcov_sampling_rate): New extern declaration.
>        (gcov_sampling_rate_initialized, __gcov_sample_counter): New globals.
>        (gcov_exit): Set sampling rate; minor coding style fixes.
>        * params.def (PARAM_PROFILE_GENERATE_SAMPLING_RATE): New parameter.
>
> Index: gcc/doc/invoke.texi
> ===
> --- gcc/doc/invoke.texi (revision 173136)
> +++ gcc/doc/invoke.texi (working copy)
> @@ -375,7 +375,7 @@ Objective-C and Objective-C++ Dialects}.
>  -fpartial-inlining -fpeel-loops -fpredictive-commoning @gol
>  -fprefetch-loop-arrays @gol
>  -fprofile-correction -fprofile-dir=@var{path} -fprofile-generate @gol
> --fprofile-generate=@var{path} @gol
> +-fprofile-generate=@var{path} -fprofile-generate-sampling @gol
>  -fprofile-use -fprofile-use=@var{path} -fprofile-values @gol
>  -freciprocal-math -fregmove -frename-registers -freorder-blocks @gol
>  -freorder-blocks-and-partition -freorder-functions @gol
> @@ -7923,6 +7923,20 @@ The following options are enabled: @code{-fprofile
>  If @var{path} is specified, GCC will look at the @var{path} to find
>  the profile feedback data files. See @option{-fprofile-dir}.
>
> +@item -fprofile-generate-sampling
> +@opindex -fprofile-generate-sampling
> +
> +Enable sampling for instrumented binaries.  Instead of recording every event,
> +record only every N-th event, where N (the sampling rate) can be set either
> +at compile time using
> +@option{--param profile-generate-sampling-rate=@var{value}}, or
> +at execution start time through environment variable 
> @samp{GCOV_SAMPLING_RATE}.
> +
> +At this time sampling applies only to branch counters.  A sampling rate of 
> 100
> +decreases instrumentated binary slowdown from up to 20x for heavily threaded
> +applications down to around 2x.  @option{-fprofile-correction} is always
> +needed with sampling.
> +
>  @item -fprofile-use
>  @itemx -fprofile-use=@var{path}
>  @opindex fprofile-use
> @@ -9138,6 +9152,9 @@ recognize.
>  If you want to pass an option that takes an argument, you must use
>  @option{-Xassembler} twice, once for the option and once for the argument.
>
> +@item profile-generate-sampling-rate
> +Set the sampling rate with @option{-fprofile-generate-sampling}.
> +
>  @end table
>
>  @node Link Options
> Index: gcc/gcov-io.h
> ===
> --- gcc/gcov-io.h       (revision 173136)
> +++ gcc/gcov-io.h       (working copy)
> @@ -544,6 +544,9 @@ struct dyn_imp_mod
>  /* Register a new object file module.  */
>  extern void __gcov_init (struct gcov_info *) ATTRIBUTE_HIDDEN;
>
> +/* Set sampling rate to RATE.  */
> +extern void __gcov_set_sampling_rate (unsigned int rate);
> +
>  /* Called before fork, to avoid double counting.  */
>  extern void __gcov_flush (void) ATTRIBUTE_HIDDEN;
>
> Index: gcc/profile.c
> ===
> --- gcc/profile.c       (revision 173136)
> +++ gcc/profile.c       (working copy)
> @@ -1210,6 +1210,9 @@ branch_prob (void)
>
>       /* Commit changes done by instrumentation.  */
>       gsi_commit_edge_inserts

[google] Updated patch (issue4438079)

2011-04-28 Thread Sharad Singhai
I have fixed documentation so that new params are documented
separately along with default values. Also used profile_status
variable.

I experimented with scaling defaults but that was not always possible
as some parameters need to be more indpependent.

Thanks,
Sharad

Google Ref 40474

2011-04-28  Sharad Singhai  

gcc/ChangeLog.google-main
* params.def: Add new parameters to control peeling.
* tree-ssa-loop-ivcanon.c (try_unroll_loop_completely): Use
different peeling parameters when profile feedback is available.
* loop-unroll.c (decide_peel_once_rolling): Ditto.
(decide_peel_completely): Ditto.
* doc/invoke.texi: Document new peeling parameters.

testsuite/ChangeLog.google-main
* gcc.dg/vect/O3-vect-pr34223.c: Add extra peeling
parameters.
* gcc.dg/vect/vect.exp: Allow reading flags in individual
tests.

Index: doc/invoke.texi
===
--- doc/invoke.texi (revision 173140)
+++ doc/invoke.texi (working copy)
@@ -8634,9 +8634,29 @@
 @item max-completely-peeled-insns
 The maximum number of insns of a completely peeled loop.
 
+@item max-completely-peeled-insns-feedback
+The maximum number of insns of a completely peeled loop when profile
+feedback is available and the loop is hot. Because of the real
+profiles, this value may set to be larger for hot loops. Its default
+value is 600.
+
+@item max-once-peeled-insns
+The maximum number of insns of a peeled loop that rolls only once.
+
+@item max-once-peeled-insns-feedback
+The maximum number of insns of a peeled loop when profile feedback is
+available and the loop is hot. Because of the real profiles, this
+value may set to be larger for hot loops. The default value is 600.
+
 @item max-completely-peel-times
 The maximum number of iterations of a loop to be suitable for complete peeling.
 
+@item max-completely-peel-times-feedback
+The maximum number of iterations of a loop to be suitable for complete
+peeling when profile feedback is available and the loop is
+hot. Because of the real profiles, this value may set to be larger for
+hot loops. Its default value is 16.
+
 @item max-completely-peel-loop-nest-depth
 The maximum depth of a loop nest suitable for complete peeling.
 
Index: testsuite/gcc.dg/vect/O3-vect-pr34223.c
===
--- testsuite/gcc.dg/vect/O3-vect-pr34223.c (revision 173140)
+++ testsuite/gcc.dg/vect/O3-vect-pr34223.c (working copy)
@@ -1,4 +1,5 @@
 /* { dg-require-effective-target vect_int } */
+/* { dg-options "[vect_cflags] --param max-completely-peel-times=16" } */
 
 #include "tree-vect.h"
 
Index: testsuite/gcc.dg/vect/vect.exp
===
--- testsuite/gcc.dg/vect/vect.exp  (revision 173140)
+++ testsuite/gcc.dg/vect/vect.exp  (working copy)
@@ -24,6 +24,12 @@
 global DEFAULT_VECTCFLAGS
 set DEFAULT_VECTCFLAGS ""
 
+# So that we can read flags in individual tests.
+proc vect_cflags { } {
+  global DEFAULT_VECTCFLAGS
+  return $DEFAULT_VECTCFLAGS
+}
+
 # If the target system supports vector instructions, the default action
 # for a test is 'run', otherwise it's 'compile'.  Save current default.
 # Executing vector instructions on a system without hardware vector support
Index: tree-ssa-loop-ivcanon.c
===
--- tree-ssa-loop-ivcanon.c (revision 173140)
+++ tree-ssa-loop-ivcanon.c (working copy)
@@ -326,6 +326,7 @@
enum unroll_level ul)
 {
   unsigned HOST_WIDE_INT n_unroll, ninsns, max_unroll, unr_insns;
+  unsigned HOST_WIDE_INT max_peeled_insns;
   gimple cond;
   struct loop_size size;
 
@@ -336,9 +337,22 @@
 return false;
   n_unroll = tree_low_cst (niter, 1);
 
-  max_unroll = PARAM_VALUE (PARAM_MAX_COMPLETELY_PEEL_TIMES);
+  if (profile_status == PROFILE_READ
+  && optimize_loop_for_speed_p (loop))
+max_unroll = PARAM_VALUE (PARAM_MAX_COMPLETELY_PEEL_TIMES_FEEDBACK);
+  else
+max_unroll = PARAM_VALUE (PARAM_MAX_COMPLETELY_PEEL_TIMES);
+
   if (n_unroll > max_unroll)
+{
+  if (dump_file && (dump_flags & TDF_DETAILS))
+   {
+ fprintf (dump_file, "  Not unrolling loop %d limited by max unroll"
+   " (%d > %d)\n",
+   loop->num, (int) n_unroll, (int) max_unroll);
+}
 return false;
+  }
 
   if (n_unroll)
 {
@@ -356,14 +370,20 @@
   (int) unr_insns);
}
 
-  if (unr_insns > ninsns
- && (unr_insns
- > (unsigned) PARAM_VALUE (PARAM_MAX_COMPLETELY_PEELED_INSNS)))
+  if (profile_status == PROFILE_READ
+  && optimize_loop_for_speed_p (loop))
+max_peeled_insns =
+  PARAM_VALUE (PARAM_MAX_COMPLETELY_PEELED_INSNS_FEEDBACK);
+  else
+max_peeled_insns = PARAM_VALUE (PARAM_MAX_COMPLETELY_PE

Re: PowerPC64 non-delegitimized UNSPEC_TOCREL

2011-04-28 Thread Alan Modra
On Thu, Apr 28, 2011 at 01:58:24PM -0400, David Edelsohn wrote:
> On Thu, Apr 28, 2011 at 11:22 AM, Alan Modra  wrote:
> > * config/rs6000/rs6000.c (rs6000_delegitimize_address): Handle
> >   unspec plus offset.  Tidy macho code.
> 
> Looks good.

Committed mainline revision 173141.  I meant to ask about 4.6 as we
have the same problem there.  OK for 4.6 too?

-- 
Alan Modra
Australia Development Lab, IBM


Re: [google]Add support for sampled profile collection (issue4438083)

2011-04-28 Thread Silvius Rus
On Thu, Apr 28, 2011 at 4:58 PM, Xinliang David Li  wrote:
>
> + Honza
>
> This patch may be a candidate for trunk as well. This feature not only
> allows profile collection with much less overhead (for multi-thread
> programs with hot regions, the slow down can be significant due to
> cache ping-pong effect of counter update) without sacrificing too much
> the performance.
>

At an extreme I saw overhead reduction from 30x to 2x on actual server
applications, but 10x to 2x was more common.  10x may not be an issue
for some workloads.  There's "train" input for SPEC.  But when you
have a server that needs to warm up 3 hours before the function
profile becomes relevant, that 10x to 2x makes the qualitative
difference.

I'm stating the obvious, but, for the record, note that turning this
on for single threaded applications would actually lead to overhead
(about 30%), as the sampling code is more expensive than the counter
update on a single core.  That's why it's not turned on by default.

>
> Another usage for this support is that it allows profile collection to
> be turned on/off asynchronously for long running server programs which
> sometimes profile data in warm up period is not important and should
> be excluded.
>

For completeness, I tried at some point to add two wrappers, the first
as an on/off switch and the second this proposed sampling wrapper.
But code size almost doubled and overhead went up significantly, so I
ditched the on/off switch.  The workaround is to start with a very
large sampling rate and then make a call into libgcov to reset the
rate at runtime, just when you're ready to measure.

> A known limitation is that value profiling is not yet sampled, but it
> does not seem to cause problems.
>
> David

Thank you, Easwaran and David, for bringing this upstream.  Mea culpa.
Silvius


[pph] Save/restore PARM_DECL DECL_ARG_TYPE (issue4441079)

2011-04-28 Thread Lawrence Crowl
This patch saves and restores the PARM_DECL DECL_ARG_TYPE in the PPH file.

Index: gcc/cp/ChangeLog.pph

2011-04-28  Lawrence Crowl 

* pph-streamer-out.c (pph_stream_write_tree): Write PARM_DECL
DECL_ARG_TYPE.
* pph-streamer-in.c (pph_stream_read_tree): Read PARM_DECL
DECL_ARG_TYPE.


Index: gcc/cp/pph-streamer-in.c
===
--- gcc/cp/pph-streamer-in.c(revision 173124)
+++ gcc/cp/pph-streamer-in.c(working copy)
@@ -791,6 +791,8 @@ pph_stream_read_tree (struct lto_input_b
  pph_stream_read_lang_specific (stream, expr);
  if (TREE_CODE (expr) == FUNCTION_DECL)
DECL_SAVED_TREE (expr) = pph_input_tree (stream);
+ else if (TREE_CODE (expr) == PARM_DECL)
+   DECL_ARG_TYPE (expr) = pph_input_tree (stream);
}
 
   if (TREE_CODE (expr) == TYPE_DECL)
Index: gcc/cp/pph-streamer-out.c
===
--- gcc/cp/pph-streamer-out.c   (revision 173124)
+++ gcc/cp/pph-streamer-out.c   (working copy)
@@ -796,6 +796,8 @@ pph_stream_write_tree (struct output_blo
 
  if (TREE_CODE (expr) == FUNCTION_DECL)
pph_output_tree_or_ref_1 (stream, DECL_SAVED_TREE (expr), ref_p, 3);
+ else if (TREE_CODE (expr) == PARM_DECL)
+   pph_output_tree_or_ref_1 (stream, DECL_ARG_TYPE (expr), ref_p, 3);
}
 
   if (TREE_CODE (expr) == TYPE_DECL)

--
This patch is available for review at http://codereview.appspot.com/4441079


Re: [google]Add support for sampled profile collection (issue4438083)

2011-04-28 Thread Mike Stump
On Apr 28, 2011, at 4:42 PM, Easwaran Raman wrote:
> This patch from Silvius Rus  adds support for sampled edge profile collection 
> to reduce instrumentation run overhead.

Sounds interesting for trunk...


Re: [google] Use R_ARM_GOT_PREL to simplify global address loading from GOT (issue4433079)

2011-04-28 Thread Carrot Wei
On Thu, Apr 28, 2011 at 10:08 PM,   wrote:
> I only have some stylistic comments for this patch.  The new pass looks
> OK to me, but I do not know this area well enough to do a good review.
>
> In your ChangeLog entries, please remove the directory prefix from the
> file names.
>
done.

>
> http://codereview.appspot.com/4433079/diff/1/gcc/hooks.c
> File gcc/hooks.c (right):
>
> http://codereview.appspot.com/4433079/diff/1/gcc/hooks.c#newcode287
> gcc/hooks.c:287: return NULL;
> +hook_rtx_void_null (void)
> +{
> +  return NULL;
>
> s/NULL/NULL_RTX/
>
done.

> http://codereview.appspot.com/4433079/diff/1/gcc/simplify-got.c
> File gcc/simplify-got.c (right):
>
> http://codereview.appspot.com/4433079/diff/1/gcc/simplify-got.c#newcode83
> gcc/simplify-got.c:83: return (optimize > 0) &&
> targetm.got_access.get_pic_reg ();
> +{
> +  return (optimize > 0) && targetm.got_access.get_pic_reg ();
>
> s/(optimize > 0)/optimize/
>
done.

> http://codereview.appspot.com/4433079/diff/1/gcc/simplify-got.c#newcode118
> gcc/simplify-got.c:118: if (!(set && (SET_DEST (set) == pic_reg)))
> +         /* If an insn both set and use pic_reg, it is in the process of
> +            constructing the value of pic_reg. We should also ignore it.
>  */
> +         rtx set = single_set (insn);
> +         if (!(set && (SET_DEST (set) == pic_reg)))
>
> Extra ( ) around SET_DEST are not needed.
>
done.

> http://codereview.appspot.com/4433079/
>

The revised patch is attached.

thanks
Carrot


patch.diff
Description: Binary data


Re: [google] Use R_ARM_GOT_PREL to simplify global address loading from GOT (issue4433079)

2011-04-28 Thread Carrot Wei
Yes, after porting it to google/main.

Carrot

On Thu, Apr 28, 2011 at 10:26 PM, Diego Novillo  wrote:
> Will you be proposing this patch for trunk as well?
>
>
> Diego.
>


Re: [google] Use R_ARM_GOT_PREL to simplify global address loading from GOT (issue4433079)

2011-04-28 Thread Xinliang David Li
Ok for google/main.

David

On Thu, Apr 28, 2011 at 8:18 PM, Carrot Wei  wrote:
> Yes, after porting it to google/main.
>
> Carrot
>
> On Thu, Apr 28, 2011 at 10:26 PM, Diego Novillo  wrote:
>> Will you be proposing this patch for trunk as well?
>>
>>
>> Diego.
>>
>


[PR 48093] document -mtls-dialect opt (and GCC_COMPARE_DEBUG env)

2011-04-28 Thread Alexandre Oliva
Ok to install?

for  gcc/ChangeLog
from  Alexandre Oliva  

	PR other/48093
	* doc/invoke.texi: Document -mtls-dialect and GCC_COMPARE_DEBUG.

Index: gcc/doc/invoke.texi
===
--- gcc/doc/invoke.texi.orig	2011-04-27 15:59:46.0 -0300
+++ gcc/doc/invoke.texi	2011-04-29 01:31:58.603523692 -0300
@@ -12581,6 +12581,13 @@ SYSV ABI.  You can control this behavior
 using the function attribute @samp{ms_abi}/@samp{sysv_abi}.
 @xref{Function Attributes}.
 
+@item -mtls-dialect=@var{type}
+@opindex mtls-dialect
+Generate code to access thread-local storage using the @samp{gnu} or
+@samp{gnu2} conventions.  @samp{gnu} is the conservative default;
+@samp{gnu2} is more efficient, but it may add compile- and run-time
+requirements that are cannot be satisfied on all systems.
+
 @item -mpush-args
 @itemx -mno-push-args
 @opindex mpush-args
@@ -18239,6 +18246,12 @@ compilation which is to be used as input
 the output of the preprocessor, which is the input to the compiler
 proper.
 
+@item GCC_COMPARE_DEBUG
+@findex GCC_COMPARE_DEBUG
+Setting @env{GCC_COMPARE_DEBUG} is nearly equivalent to passing
+@option{-fcompare-debug} to the compiler driver.  See the documentation
+of this option for more details.
+
 @item GCC_EXEC_PREFIX
 @findex GCC_EXEC_PREFIX
 If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the

-- 
Alexandre Oliva, freedom fighterhttp://FSFLA.org/~lxoliva/
You must be the change you wish to see in the world. -- Gandhi
Be Free! -- http://FSFLA.org/   FSF Latin America board member
Free Software Evangelist  Red Hat Brazil Compiler Engineer


Re: [google]Add support for sampled profile collection (issue4438083)

2011-04-28 Thread Xinliang David Li
Please add regression test cases for the feature. Address the comments
when available. Ok for google/main.

Thanks,

David

On Thu, Apr 28, 2011 at 4:42 PM, Easwaran Raman  wrote:
> This patch from Silvius Rus  adds support for sampled edge profile collection 
> to reduce instrumentation run overhead. Bootstraps and no test regressions. 
> Ok for google/main?
>
> 2011-04-28  Silvius Rus  
>
>        * doc/invoke.texi: Document -fprofile-generate-sampling option.
>        * gcov-io.h (__gcov_set_sampling_rate): New declaration.
>        * profile.c (branch_prob): Add support for sampled profile
>        collection.
>        * profile.h (add_sampling_to_edge_counters): New declaration.
>        * common.opt (fprofile-generate-sampling): New option.
>        * tree-profile: Include header files; define EDGE_COUNTER_STMT_COUNT.
>        (instrumentation_to_be_sampled, gcov_sample_counter_decl)
>        (gcov_sampling_rate_decl): New globals.
>        (insert_if_then, add_sampling_wrapper, 
> is_instrumentation_to_be_sampled)
>        (add_sampling_to_edge_counters, gimple_init_instrumentation_sampling):
>        New functions.
>        (gimple_init_edge_profiler): Call gimple_init_instrumentation_sampling.
>        (gimple_gen_edge_profiler): Mark start of instrumentation block.
>        * libgcov.c (__gcov_sampling_rate): New extern declaration.
>        (gcov_sampling_rate_initialized, __gcov_sample_counter): New globals.
>        (gcov_exit): Set sampling rate; minor coding style fixes.
>        * params.def (PARAM_PROFILE_GENERATE_SAMPLING_RATE): New parameter.
>
> Index: gcc/doc/invoke.texi
> ===
> --- gcc/doc/invoke.texi (revision 173136)
> +++ gcc/doc/invoke.texi (working copy)
> @@ -375,7 +375,7 @@ Objective-C and Objective-C++ Dialects}.
>  -fpartial-inlining -fpeel-loops -fpredictive-commoning @gol
>  -fprefetch-loop-arrays @gol
>  -fprofile-correction -fprofile-dir=@var{path} -fprofile-generate @gol
> --fprofile-generate=@var{path} @gol
> +-fprofile-generate=@var{path} -fprofile-generate-sampling @gol
>  -fprofile-use -fprofile-use=@var{path} -fprofile-values @gol
>  -freciprocal-math -fregmove -frename-registers -freorder-blocks @gol
>  -freorder-blocks-and-partition -freorder-functions @gol
> @@ -7923,6 +7923,20 @@ The following options are enabled: @code{-fprofile
>  If @var{path} is specified, GCC will look at the @var{path} to find
>  the profile feedback data files. See @option{-fprofile-dir}.
>
> +@item -fprofile-generate-sampling
> +@opindex -fprofile-generate-sampling
> +
> +Enable sampling for instrumented binaries.  Instead of recording every event,
> +record only every N-th event, where N (the sampling rate) can be set either
> +at compile time using
> +@option{--param profile-generate-sampling-rate=@var{value}}, or
> +at execution start time through environment variable 
> @samp{GCOV_SAMPLING_RATE}.
> +
> +At this time sampling applies only to branch counters.  A sampling rate of 
> 100
> +decreases instrumentated binary slowdown from up to 20x for heavily threaded
> +applications down to around 2x.  @option{-fprofile-correction} is always
> +needed with sampling.
> +
>  @item -fprofile-use
>  @itemx -fprofile-use=@var{path}
>  @opindex fprofile-use
> @@ -9138,6 +9152,9 @@ recognize.
>  If you want to pass an option that takes an argument, you must use
>  @option{-Xassembler} twice, once for the option and once for the argument.
>
> +@item profile-generate-sampling-rate
> +Set the sampling rate with @option{-fprofile-generate-sampling}.
> +
>  @end table
>
>  @node Link Options
> Index: gcc/gcov-io.h
> ===
> --- gcc/gcov-io.h       (revision 173136)
> +++ gcc/gcov-io.h       (working copy)
> @@ -544,6 +544,9 @@ struct dyn_imp_mod
>  /* Register a new object file module.  */
>  extern void __gcov_init (struct gcov_info *) ATTRIBUTE_HIDDEN;
>
> +/* Set sampling rate to RATE.  */
> +extern void __gcov_set_sampling_rate (unsigned int rate);
> +
>  /* Called before fork, to avoid double counting.  */
>  extern void __gcov_flush (void) ATTRIBUTE_HIDDEN;
>
> Index: gcc/profile.c
> ===
> --- gcc/profile.c       (revision 173136)
> +++ gcc/profile.c       (working copy)
> @@ -1210,6 +1210,9 @@ branch_prob (void)
>
>       /* Commit changes done by instrumentation.  */
>       gsi_commit_edge_inserts ();
> +
> +      if (flag_profile_generate_sampling)
> +        add_sampling_to_edge_counters ();
>     }
>
>   free_aux_for_edges ();
> Index: gcc/profile.h
> ===
> --- gcc/profile.h       (revision 173136)
> +++ gcc/profile.h       (working copy)
> @@ -47,4 +47,10 @@ extern gcov_type sum_edge_counts (VEC (edge, gc) *
>  extern void init_node_map (void);
>  extern void del_node_map (void);
>
> +/* Implement sampling to avoid writing to edge counter

Re: Scheduler cleanups, 1/N

2011-04-28 Thread Alexandre Oliva
On Apr  5, 2011, Alexandre Oliva  wrote:

>> +  if (flag_sched_last_insn_heuristic
>> +  && NONDEBUG_INSN_P (last_nondebug_scheduled_insn))

>> Isn't that always true now

> Not if it's the initial NOTE.

>> (except we should probably initialize it to NULL_RTX and check for
>> that here)?

> Good idea.  Will try that, retest, and apply if it passes.

Here's what I'm (finally) installing, regstrapped several times on
x86_64-linux-gnu and i686-pc-linux-gnu.

for  gcc/ChangeLog
from  Alexandre Oliva  

	* haifa-sched.c (last_nondebug_scheduled_insn): New.
	(rank_for_schedule): Use it.
	(schedule_block): Set it.
	
Index: gcc/haifa-sched.c
===
--- gcc/haifa-sched.c.orig	2011-04-05 05:29:27.91535 -0300
+++ gcc/haifa-sched.c	2011-04-05 19:37:59.224096719 -0300
@@ -783,6 +783,12 @@ print_curr_reg_pressure (void)
 /* Pointer to the last instruction scheduled.  */
 static rtx last_scheduled_insn;
 
+/* Pointer to the last nondebug instruction scheduled within the
+   block, or the prev_head of the scheduling block.  Used by
+   rank_for_schedule, so that insns independent of the last scheduled
+   insn will be preferred over dependent instructions.  */
+static rtx last_nondebug_scheduled_insn;
+
 /* Pointer that iterates through the list of unscheduled insns if we
have a dbg_cnt enabled.  It always points at an insn prior to the
first unscheduled one.  */
@@ -1158,7 +1164,6 @@ rank_for_schedule (const void *x, const 
 {
   rtx tmp = *(const rtx *) y;
   rtx tmp2 = *(const rtx *) x;
-  rtx last;
   int tmp_class, tmp2_class;
   int val, priority_val, info_val;
 
@@ -1239,24 +1244,13 @@ rank_for_schedule (const void *x, const 
   if(flag_sched_rank_heuristic && info_val)
 return info_val;
 
-  if (flag_sched_last_insn_heuristic)
-{
-  int i = VEC_length (rtx, scheduled_insns);
-  last = NULL_RTX;
-  while (i-- > 0)
-	{
-	  last = VEC_index (rtx, scheduled_insns, i);
-	  if (NONDEBUG_INSN_P (last))
-	break;
-	}
-}
-
   /* Compare insns based on their relation to the last scheduled
  non-debug insn.  */
-  if (flag_sched_last_insn_heuristic && last && NONDEBUG_INSN_P (last))
+  if (flag_sched_last_insn_heuristic && last_nondebug_scheduled_insn)
 {
   dep_t dep1;
   dep_t dep2;
+  rtx last = last_nondebug_scheduled_insn;
 
   /* Classify the instructions into three classes:
  1) Data dependent on last schedule insn.
@@ -2967,6 +2961,7 @@ schedule_block (basic_block *target_bb)
 
   /* We start inserting insns after PREV_HEAD.  */
   last_scheduled_insn = nonscheduled_insns_begin = prev_head;
+  last_nondebug_scheduled_insn = NULL_RTX;
 
   gcc_assert ((NOTE_P (last_scheduled_insn)
 	   || DEBUG_INSN_P (last_scheduled_insn))
@@ -3226,7 +3221,8 @@ schedule_block (basic_block *target_bb)
 	  /* Update counters, etc in the scheduler's front end.  */
 	  (*current_sched_info->begin_schedule_ready) (insn);
 	  VEC_safe_push (rtx, heap, scheduled_insns, insn);
-	  last_scheduled_insn = insn;
+	  gcc_assert (NONDEBUG_INSN_P (insn));
+	  last_nondebug_scheduled_insn = last_scheduled_insn = insn;
 
 	  if (recog_memoized (insn) >= 0)
 	{

-- 
Alexandre Oliva, freedom fighterhttp://FSFLA.org/~lxoliva/
You must be the change you wish to see in the world. -- Gandhi
Be Free! -- http://FSFLA.org/   FSF Latin America board member
Free Software Evangelist  Red Hat Brazil Compiler Engineer


Re: [google] Use R_ARM_GOT_PREL to simplify global address loading from GOT (issue4433079)

2011-04-28 Thread Carrot Wei
On Fri, Apr 29, 2011 at 11:17 AM, Carrot Wei  wrote:
> On Thu, Apr 28, 2011 at 10:08 PM,   wrote:
>> I only have some stylistic comments for this patch.  The new pass looks
>> OK to me, but I do not know this area well enough to do a good review.
>>
>> In your ChangeLog entries, please remove the directory prefix from the
>> file names.
>>
> done.
>
>>
>> http://codereview.appspot.com/4433079/diff/1/gcc/hooks.c
>> File gcc/hooks.c (right):
>>
>> http://codereview.appspot.com/4433079/diff/1/gcc/hooks.c#newcode287
>> gcc/hooks.c:287: return NULL;
>> +hook_rtx_void_null (void)
>> +{
>> +  return NULL;
>>
>> s/NULL/NULL_RTX/
>>
> done.
>
Oops. File hooks.c doesn't include rtl.h, so either rtl.h should be
included, or return NULL instead, like other functions in this file.


[PR 47994] skip debug insns in combine m_split tests

2011-04-28 Thread Alexandre Oliva
The testcase in PR 47994, as well as one of the tests in 47919, exposed
our failure to skip debug insns when testing whether it is safe to split
the unrecognizable insn resulting from combining 3 insns.
Unfortunately, both testcases are far too sensitive to other changes in
the compiler, to the point of being unusable as regression tests IMHO.

Regstrapped on x86_64-linux-gnu and i686-pc-linux-gnu.  Ok to install?

for  gcc/ChangeLog
from  Alexandre Oliva  

	PR debug/47994
	PR debug/47919
	* combine.c (try_combine): Skip debug insns at m_split tests.

Index: gcc/combine.c
===
--- gcc/combine.c.orig	2011-04-29 02:16:34.718995124 -0300
+++ gcc/combine.c	2011-04-29 02:16:54.454998871 -0300
@@ -3457,7 +3457,7 @@ try_combine (rtx i3, rtx i2, rtx i1, rtx
 	newpat = m_split;
 	}
   else if (m_split && NEXT_INSN (NEXT_INSN (m_split)) == NULL_RTX
-	   && (next_real_insn (i2) == i3
+	   && (next_nonnote_nondebug_insn (i2) == i3
 		   || ! use_crosses_set_p (PATTERN (m_split), DF_INSN_LUID (i2
 	{
 	  rtx i2set, i3set;
@@ -3474,7 +3474,7 @@ try_combine (rtx i3, rtx i2, rtx i1, rtx
 	 is used between I2 and I3, we also can't use these insns.  */
 
 	  if (i2_code_number >= 0 && i2set && i3set
-	  && (next_real_insn (i2) == i3
+	  && (next_nonnote_nondebug_insn (i2) == i3
 		  || ! reg_used_between_p (SET_DEST (i2set), i2, i3)))
 	insn_code_number = recog_for_combine (&newi3pat, i3,
 		  &new_i3_notes);
@@ -3522,7 +3522,7 @@ try_combine (rtx i3, rtx i2, rtx i1, rtx
 	  || GET_MODE (*split) == VOIDmode
 	  || can_change_dest_mode (i2dest, added_sets_2,
    GET_MODE (*split)))
-	  && (next_real_insn (i2) == i3
+	  && (next_nonnote_nondebug_insn (i2) == i3
 	  || ! use_crosses_set_p (*split, DF_INSN_LUID (i2)))
 	  /* We can't overwrite I2DEST if its value is still used by
 	 NEWPAT.  */

-- 
Alexandre Oliva, freedom fighterhttp://FSFLA.org/~lxoliva/
You must be the change you wish to see in the world. -- Gandhi
Be Free! -- http://FSFLA.org/   FSF Latin America board member
Free Software Evangelist  Red Hat Brazil Compiler Engineer


Re: (build) Patch to fix cp/cfns.gperf building issues

2011-04-28 Thread Alexandre Oliva
On Apr 23, 2011, "Nicola Pero"  wrote:

> Ok to commit ?

Yeah, thanks.

> Index: ChangeLog
> +2011-04-22  Nicola Pero  
> +
> +   * Makefile.in (ENABLE_MAINTAINER_RULES): New.
> +
> Index: cp/ChangeLog
> +2011-04-23  Nicola Pero  ,
> +   Mike Stump 
> +
> +   * Make-lang.in ($(srcdir)/cp/cfns.h): Enable the dependency only
> +   in maintainer mode.  Use the --output-file option of gperf instead
> +   of > to prevent creating an empty cp/cfns.h when gperf is not
> +   available.
> +

-pedantic review: how about outputting to a temporary file (say
cp/cfns.hT) and only renaming to the intended name on success, so that,
if gperf crashes or we reboot part-way through it, we don't end up with
a partially-generated file that will seem to be up to date?

-- 
Alexandre Oliva, freedom fighterhttp://FSFLA.org/~lxoliva/
You must be the change you wish to see in the world. -- Gandhi
Be Free! -- http://FSFLA.org/   FSF Latin America board member
Free Software Evangelist  Red Hat Brazil Compiler Engineer


Re: [patch, libgfortran] Fix numerous formatting bugs

2011-04-28 Thread Jerry DeLisle

On 04/27/2011 12:57 PM, Janne Blomqvist wrote:

On Wed, Apr 27, 2011 at 08:53, Janne Blomqvist
  wrote:

On Wed, Apr 27, 2011 at 07:09, Jerry DeLisle  wrote:

On 04/25/2011 07:36 AM, Janne Blomqvist wrote:


On Mon, Apr 25, 2011 at 14:44, Jerry DeLisle
  wrote:


On 04/25/2011 03:48 AM, Janne Blomqvist wrote:


Now, for one of the testcase changes:

--- gcc/testsuite/gfortran.dg/char4_iunit_1.f03 (revision 172909)
+++ gcc/testsuite/gfortran.dg/char4_iunit_1.f03 (working copy)
@@ -24,11 +24,11 @@ program char4_iunit_1
write(string, *) .true., .false. , .true.
if (string .ne. 4_" T F T") call
abort
write(string, *) 1.2345e-06, 4.2846e+10_8
-  if (string .ne. 4_"  1.23450002E-06   4284600.00 ") call
abort
+  if (string .ne. 4_"  1.234500019E-06   4284600.00") call
abort

This looks wrong. For correctly rounded REAL(4) output, we need 9
significant digits, but here we print 10.



Well, I bumped it up for defaults based on pr48488 comment #2 shown
below.


Yes, that comment in the PR is correct; to guarantee that a
binary->ascii->binary roundtrip preserves the original binary value
(with the default "round to nearest, break on even" rounding mode),
one must output at least {9, 17, 21, 36} significant digits for real
kinds 4, 8, 10, and 16, respectively (yes, I double-checked IEEE
754-2008 that this is indeed correct).

Since for the G edit descriptor d is equivalent to the number of
significant digits, AFAICS the write.c patch below is correct and the
bug must be elsewhere, no?



No.

Look at this example:

program t4
  implicit none
  character(len=44) :: string
  write(*,*) 1.2345e-06, 4.2846e+10_8
  write(*,'(1x,1pG16.9e2,1x,1pG25.17e3)') 1.2345e-06, 4.2846e+10_8
  write(*,'(1x,1pG15.8e2,1x,1pG25.17e3)') 1.2345e-06, 4.2846e+10_8
end program t4

This gives with the patch:

  1.234500019E-06   4284600.00
  1.234500019E-06   4284600.00
  1.23450002E-06   4284600.00

And without the patch:

  1.23450002E-06   4284600.00
  1.234500019E-06   4284600.00
  1.23450002E-06   4284600.00

d is the number of digits after the decimal point, not the number of
significant digits.


I stand corrected. Or well, I still stand by my previous statement
that with the G edit descriptor d corresponds to the number of
significant digits. However, only when not using the scale factor.

Since we use a scale factor of 1, when the magnitude of the number is
such that the E edit descriptor is used, according to F2008 10.7.2.3.3
paragraph 6 for 0<  k<  d+2 we must print k significant digits to the
left of the decimal point and d-k+1 to the right. That is, with k=1 we
print one digit to the left of the decimal point and d-1+1=d to the
right which has the effect of increasing the number of significant
digits by one!

However, when the magnitude of the value is such that F editing is
used, the scale factor has no effect and we thus print d significant
digits.

So in order to guarantee an exact binary<->ascii roundtrip we must
accept an extra digit in some cases. Or then do something which would
make list formatted (and perhaps G0 as well?) write differ from 1PGw.d
(effectively, reduce d by one when the magnitude is such that E
editing is used)?


That is, what about something like the attached patch on top of your
patch. With the patch, the test program

program t4
  implicit none
  character(len=44) :: string
  write(*,*) 1.2345e-06, 4.2846e+10_8, 1.1
  write(*,'(1x,1pG16.9e2,1x,1pG25.17e3)') 1.2345e-06, 4.2846e+10_8
  write(*,'(1x,1pG15.8e2,1x,1pG25.17e3)') 1.2345e-06, 4.2846e+10_8
  write(*,'(1x,1pG0,1x,1pG0)') 1.2345e-06, 1.1
  write(*,'(1x,1pG0.9,1x,1pG0.9)') 1.2345e-06, 1.1
end program t4

outputs

1.23450002E-06   4284600.001.1002
   1.234500019E-06   4284600.00
   1.23450002E-06   4284600.00
  1.23450002E-06 1.1002
  1.234500019E-06 1.1002

So the change is that now it prints the same number of significant
digits in E and F mode, both for list formatted output and kPG0 when
k>=0. For list formatted we can do pretty much what we want, and for
G0 the standard only says the processor can choose appropriate values
for w, d, and e. So far we have chosen d and e only based on the kind,
but AFAICS nothing prevents taking into account the magnitude as well.

I haven't modified any of the testcases so I expect some number of
regressions due to that, but I'm asking for opinions on the approach
itself before doing that.



Actually only saw one test case failure which I have adjusted.  The attached 
patch applies Janne's patch to my patch and the fix for pr48787.  Regression 
tested on x86-64.


OK for trunk?  I sure would like to get this in so I can move on to other 
things.

Jerry
Index: gcc/testsuite/gfortran.dg/fmt_g.f
===
--- gcc/testsuite/gfortran.dg/fmt_g.f	(revision 172909)
+++ gcc/testsuite/gfortran.dg/f

Re: [patch, libgfortran] Fix numerous formatting bugs

2011-04-28 Thread Janne Blomqvist
On Fri, Apr 29, 2011 at 09:22, Jerry DeLisle  wrote:
> On 04/27/2011 12:57 PM, Janne Blomqvist wrote:
>> So the change is that now it prints the same number of significant
>> digits in E and F mode, both for list formatted output and kPG0 when
>> k>=0. For list formatted we can do pretty much what we want, and for
>> G0 the standard only says the processor can choose appropriate values
>> for w, d, and e. So far we have chosen d and e only based on the kind,
>> but AFAICS nothing prevents taking into account the magnitude as well.
>>
>> I haven't modified any of the testcases so I expect some number of
>> regressions due to that, but I'm asking for opinions on the approach
>> itself before doing that.
>>
>
> Actually only saw one test case failure which I have adjusted.  The attached
> patch applies Janne's patch to my patch and the fix for pr48787.  Regression
> tested on x86-64.
>
> OK for trunk?  I sure would like to get this in so I can move on to other
> things.

Ok.

-- 
Janne Blomqvist