Re: [PATCH, ARM] Fix PR 43872, incorrectly aligned VLAs

2011-03-15 Thread Ramana Radhakrishnan

On 17/02/11 10:01, Chung-Lin Tang wrote:

Hi,
this PR is a case where we have a leaf function with a zero-size frame,
that calls alloca() (here through a C99 VLA).

The ARM backend recognizes the leaf-and-no-frame opportunity to save an
unneeded stack alignment. But when calling alloca(), the allocated block
is of BIGGEST_ALIGNMENT, which is 8-bytes under current AAPCS. Thus a
stack align may still be needed to place the alloca() returned block
properly.

This patch adjusts the early return condition with !cfun-calls_alloca.
Tested without regressions on ARM-Linux, okay for trunk?


OK.



Also related, the BIGGEST_ALIGNMENT defined for ARM is currently
ABI-based; 64-bits for AAPCS targets, and 32 for old ABI.  Should this
also consider arch-level as well? i.e. anything= ARMv5TE (with ldrd)
should have this set to 64.


I don't think it's that straightforward. The ABI specifies that an 8 
byte quantity must be aligned at 64 bit boundaries and this should be 
independent of architecture revisions. Think about pointers to 64 bit 
quantities passed from !(TARGET_LDRD) to TARGET_LDRD code or indeed 
creating structure layout issues between architecture revisions if you 
change this.


cheers
Ramana



2011-02-17  Chung-Lin Tangclt...@codesourcery.com

PR target/43872
* config/arm/arm.c (arm_get_frame_offsets): Adjust early
return condition with !cfun-calls_alloca.




Re: [PATCH: ARM] PR 45335 Use ldrd and strd to access two consecutive words

2011-03-15 Thread Carrot Wei
The trunk is opened again, could any maintainers continue to review this patch?

thanks
Carrot

On Tue, Jan 18, 2011 at 10:59 PM, Carrot Wei car...@google.com wrote:
 Ramana's method is to put the instruction output and counting in on place.
 So it's easy to keep them synchronized.

 My latest version of patch did the following modifications compared to
 the earlier version: Added support of arm ldrd/strd instructions. Added length
 attribute to insn patterns. Moved the insn patterns to file ldmstm.md.

 It has passed the dejagnu testing on arm qemu.

 thanks
 Carrot


[libgfortran, build] Remove AC_TRY_* macros from libgfortran configury

2011-03-15 Thread FX
Dear Fortran maintainers, dear autoconf gurus,

The attached patch replaces the deprecated AC_TRY_{COMPILE,LINK,RUN} macros in 
libgfortran configury with their AC_*_IFELSE equivalents. Now (4.7 just 
branched) seems a good time, and I think I didn't screw it too much because the 
regenerated configure file only has whitespace changes. Still, I'd like to have 
the opinion of a build maintainer or autoconf guru.

Bootstrapped and regtested on x86_64-darwin.

OK to commit to trunk?




ac_try.ChangeLog
Description: Binary data


ac_try.diff
Description: Binary data


[PATCH] Fix PR48031

2011-03-15 Thread Richard Guenther

We shouldn't create new VLA array accesses via fold when we are in
gimple form as we have no way to fixup the gimplified element size
and minimal value slots.

Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk
(I'll make my way backwards to the release branches after 4.6.0 is out).

Tested on m68k by Mikael.

Richard.

2011-03-15  Richard Guenther  rguent...@suse.de

PR middle-end/48031
* fold-const.c (fold_indirect_ref_1): Do not create new variable-sized
or variable-indexed array accesses when in gimple form.

Index: gcc/fold-const.c
===
*** gcc/fold-const.c(revision 170876)
--- gcc/fold-const.c(working copy)
*** fold_indirect_ref_1 (location_t loc, tre
*** 15554,15565 
}
/* *(foo *)fooarray = fooarray[0] */
else if (TREE_CODE (optype) == ARRAY_TYPE
!   type == TREE_TYPE (optype))
{
  tree type_domain = TYPE_DOMAIN (optype);
  tree min_val = size_zero_node;
  if (type_domain  TYPE_MIN_VALUE (type_domain))
min_val = TYPE_MIN_VALUE (type_domain);
  return build4_loc (loc, ARRAY_REF, type, op, min_val,
 NULL_TREE, NULL_TREE);
}
--- 15560,15576 
}
/* *(foo *)fooarray = fooarray[0] */
else if (TREE_CODE (optype) == ARRAY_TYPE
!   type == TREE_TYPE (optype)
!   (!in_gimple_form
!  || TREE_CODE (TYPE_SIZE (type)) == INTEGER_CST))
{
  tree type_domain = TYPE_DOMAIN (optype);
  tree min_val = size_zero_node;
  if (type_domain  TYPE_MIN_VALUE (type_domain))
min_val = TYPE_MIN_VALUE (type_domain);
+ if (in_gimple_form
+  TREE_CODE (min_val) != INTEGER_CST)
+   return NULL_TREE;
  return build4_loc (loc, ARRAY_REF, type, op, min_val,
 NULL_TREE, NULL_TREE);
}
*** fold_indirect_ref_1 (location_t loc, tre
*** 15633,15639 
  
/* *(foo *)fooarrptr = (*fooarrptr)[0] */
if (TREE_CODE (TREE_TYPE (subtype)) == ARRAY_TYPE
!type == TREE_TYPE (TREE_TYPE (subtype)))
  {
tree type_domain;
tree min_val = size_zero_node;
--- 15644,15652 
  
/* *(foo *)fooarrptr = (*fooarrptr)[0] */
if (TREE_CODE (TREE_TYPE (subtype)) == ARRAY_TYPE
!type == TREE_TYPE (TREE_TYPE (subtype))
!(!in_gimple_form
! || TREE_CODE (TYPE_SIZE (type)) == INTEGER_CST))
  {
tree type_domain;
tree min_val = size_zero_node;
*** fold_indirect_ref_1 (location_t loc, tre
*** 15641,15646 
--- 15654,15662 
type_domain = TYPE_DOMAIN (TREE_TYPE (sub));
if (type_domain  TYPE_MIN_VALUE (type_domain))
min_val = TYPE_MIN_VALUE (type_domain);
+   if (in_gimple_form
+  TREE_CODE (min_val) != INTEGER_CST)
+   return NULL_TREE;
return build4_loc (loc, ARRAY_REF, type, sub, min_val, NULL_TREE,
 NULL_TREE);
  }


Ping for two ARM patches

2011-03-15 Thread Richard Sandiford
Now that GCC 4.7 is open, are these two ARM patches OK to commit?

http://gcc.gnu.org/ml/gcc-patches/2011-01/msg02266.html
PR 47551: neon-related spill failure

http://gcc.gnu.org/ml/gcc-patches/2011-01/msg02284.html
PR 47553: vld1q_lane_u8  co. don't accept lanes = 8

Thanks,
Richard


Re: Fix for PR target/47951

2011-03-15 Thread Bernd Schmidt
On 03/14/2011 01:10 PM, Henderson, Stuart wrote:
 Hi, The attached patch is an attempt to fix PR 47951, however I'm
 fairly new to GCC and have little confidence in it.  I've done some
 testing with it and it avoids the problem and doesn't appear to cause
 any new problems, but I'd appreciate more experienced eyes looking
 over it and giving pointers. Thanks, Stu

Looks ok.


Bernd


[PATCH gcc/fortran] get rid of gfc_free

2011-03-15 Thread Jim Meyering
Janne Blomqvist wrote:
 On Tue, Mar 8, 2011 at 19:53, Jim Meyering j...@meyering.net wrote:
 Relative to v2, I've added libgo/ to the list of exempt directories and added
 this recently discussed gfc_free patch, at the request of Tobias Burnus.
 Also, I corrected an error in fortran's ChangeLog and removed all
 whitespace changes from all ChangeLog files.

 The libgfortran changes are Ok for 4.7.

 For the gfortran frontend (gcc/fortran/*) I'd prefer if you'd

 - Replace all calls to gfc_free (x) with free (x).
 - Remove the gfc_free() function and prototype.
 - Remove the free() macro which currently prevents calling free() directly.

Hi Janne,

These requested changes are in addition to (and independent of)
the changes that I've already posted here.  The first cset below
does your #2 and #3, and the second does #1.  I separate them for
review because #1 is completely mechanical, while the others
are manual.  You may prefer to combine them before pushing, for
bisection.  Let me know if you'd prefer I submit in that form.

...
 +It is better to avoid the test.[*]
 +Instead, simply free P, regardless of whether it is NULL.
 +
 +[*] However, if your profiling exposes a test like this in a
 +performance-critical loop, say where P is nearly always NULL, and
 +the cost of calling free on a NULL pointer would be prohibitively
 +high, please let us know.

 Instead of please let us know, maybe recommend using
 __builtin_expect instead? E.g. something like

 if (__builtin_expect (ptr != NULL, 0))
 free (ptr);

Good idea.  Thanks.
Though how about avoiding the double negative?

   if (__builtin_expect (ptr == NULL, 1))
 free (ptr);

I've squashed the following onto my just-rebased commit:

diff --git a/gcc/README.Portability b/gcc/README.Portability
index e099a3f..4101a2f 100644
--- a/gcc/README.Portability
+++ b/gcc/README.Portability
@@ -68,7 +68,11 @@ Instead, simply free P, regardless of whether it is NULL.
 [*] However, if your profiling exposes a test like this in a
 performance-critical loop, say where P is nearly always NULL, and
 the cost of calling free on a NULL pointer would be prohibitively
-high, please let us know.
+high, consider using __builtin_expect, e.g., like this:
+
+  if (__builtin_expect (ptr == NULL, 1))
+free (ptr);
+


 Trigraphs
-


From c198b77add6d587cbe87f2d86049c46196946398 Mon Sep 17 00:00:00 2001
From: Jim Meyering meyer...@redhat.com
Date: Tue, 15 Mar 2011 10:33:03 +0100
Subject: [PATCH 1/2] gfortran: remove definition and prototype of gfc_free

* misc.c (gfc_free): Remove function.
* gfortran.h (gfc_free): Remove its prototype.
(free): Remove macro definition that would otherwise prevent
direct use of the function.
---
 gcc/fortran/ChangeLog  |7 +++
 gcc/fortran/gfortran.h |2 --
 gcc/fortran/misc.c |9 -
 3 files changed, 7 insertions(+), 11 deletions(-)

diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 1871c71..bc2e1b2 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,10 @@
+2011-03-15  Jim Meyering  meyer...@redhat.com
+
+   * misc.c (gfc_free): Remove function.
+   * gfortran.h (gfc_free): Remove its prototype.
+   (free): Remove macro definition that would otherwise prevent
+   direct use of the function.
+
 2011-03-08  Jim Meyering  meyer...@redhat.com

* gfortranspec.c (lang_specific_pre_link): Remove useless
diff --git a/gcc/fortran/gfortran.h b/gcc/fortran/gfortran.h
index b64fa20..24d1941 100644
--- a/gcc/fortran/gfortran.h
+++ b/gcc/fortran/gfortran.h
@@ -49,7 +49,6 @@ along with GCC; see the file COPYING3.  If not see
 #define MAX_SUBRECORD_LENGTH 2147483639   /* 2**31-9 */


-#define free(x) Use_gfc_free_instead_of_free()
 #define gfc_is_whitespace(c) ((c==' ') || (c=='\t'))

 /* Stringization.  */
@@ -2366,7 +2365,6 @@ void gfc_end_source_files (void);

 /* misc.c */
 void *gfc_getmem (size_t) ATTRIBUTE_MALLOC;
-void gfc_free (void *);
 int gfc_terminal_width (void);
 void gfc_clear_ts (gfc_typespec *);
 FILE *gfc_open_file (const char *);
diff --git a/gcc/fortran/misc.c b/gcc/fortran/misc.c
index 8a343a0..9d7d121 100644
--- a/gcc/fortran/misc.c
+++ b/gcc/fortran/misc.c
@@ -42,15 +42,6 @@ gfc_getmem (size_t n)
 }


-void
-gfc_free (void *p)
-{
-  /* The parentheses around free are needed in order to call not
- the redefined free of gfortran.h.  */
-  (free) (p);
-}
-
-
 /* Get terminal width.  */

 int
--
1.7.4.1.408.gb6b16


From 51ec56ecddf38589511502c58d75e1680e5a17e2 Mon Sep 17 00:00:00 2001
From: Jim Meyering meyer...@redhat.com
Date: Tue, 15 Mar 2011 10:37:17 +0100
Subject: [PATCH 2/2] convert each use of gfc_free (p) to free (p)

Do that by running this command:
  perl -pi -e's/\bgfc_free ?\(/free (/' \
$(git grep -El '\bgfc_free ?\(')
which also corrects the few uses that lacked a space between the
function name and the open parenthesis.
---
 gcc/fortran/ChangeLog |7 +
 

Re: [PATCH gcc/fortran] get rid of gfc_free

2011-03-15 Thread Jim Meyering
Jakub Jelinek wrote:
 On Tue, Mar 15, 2011 at 11:02:38AM +0100, Jim Meyering wrote:
  Instead of please let us know, maybe recommend using
  __builtin_expect instead? E.g. something like
 
  if (__builtin_expect (ptr != NULL, 0))
  free (ptr);

 Good idea.  Thanks.
 Though how about avoiding the double negative?

if (__builtin_expect (ptr == NULL, 1))
  free (ptr);

 What double negative?  if (__builtin_expect (ptr != NULL, 0)) free (ptr);
 is certainly correct, the latter is wrong, it will leak memory.
 It will call free only if ptr is NULL, i.e. do a useless free (NULL),
 if it is non-NULL, it will not do anything.
 You could do
   if (!__builtin_expect (ptr == NULL, 1))
 free (ptr);
 but that doesn't seem to be nicer or clearer than
   if (__builtin_expect (ptr != NULL, 0))
 free (ptr);

Thanks for the quick correction.
I've fixed it locally, too.


[PATCH] Fix PR41490

2011-03-15 Thread Richard Guenther

This fixes store-sinking (finally, broken since alias-improvements
merge).  To work reliably this adds an unconditional VUSE to all
return statements.

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

Richard.

2011-03-15  Richard Guenther  rguent...@suse.de

PR tree-optimization/41490
* tree-ssa-dce.c (propagate_necessity): Handle returns without
value but with VUSE.
* tree-ssa-operands.c (parse_ssa_operands): Add a VUSE on all
return statements.
* tree-ssa-sink.c (statement_sink_location): Fix store sinking.
* tree-ssa-phiopt.c (tree_ssa_phiopt_worker): Handle virtual PHIs.
* tree-tailcall.c (find_tail_calls): Ignore returns.

* gcc.dg/tree-ssa/ssa-sink-6.c: New testcase.
* gcc.dg/tree-ssa/ssa-sink-7.c: Likewise.
* gcc.dg/tree-ssa/ssa-sink-8.c: Likewise.
* gcc.dg/tree-ssa/ssa-sink-9.c: Likewise.
* g++.dg/tree-ssa/pr33604.C: Adjust.

Index: gcc/tree-ssa-dce.c
===
*** gcc/tree-ssa-dce.c.orig 2011-03-09 17:57:48.0 +0100
--- gcc/tree-ssa-dce.c  2011-03-09 18:03:30.0 +0100
*** propagate_necessity (struct edge_list *e
*** 869,875 
{
  tree rhs = gimple_return_retval (stmt);
  /* A return statement may perform a load.  */
! if (TREE_CODE (rhs) != SSA_NAME
   !is_gimple_min_invariant (rhs))
{
  if (!ref_may_be_aliased (rhs))
--- 869,876 
{
  tree rhs = gimple_return_retval (stmt);
  /* A return statement may perform a load.  */
! if (rhs
!  TREE_CODE (rhs) != SSA_NAME
   !is_gimple_min_invariant (rhs))
{
  if (!ref_may_be_aliased (rhs))
Index: gcc/tree-ssa-operands.c
===
*** gcc/tree-ssa-operands.c.orig2011-03-09 17:57:48.0 +0100
--- gcc/tree-ssa-operands.c 2011-03-09 18:03:30.0 +0100
*** parse_ssa_operands (gimple stmt)
*** 1065,1070 
--- 1065,1073 
/* Add call-clobbered operands, if needed.  */
if (code == GIMPLE_CALL)
maybe_add_call_vops (stmt);
+ 
+   if (code == GIMPLE_RETURN)
+   append_vuse (gimple_vop (cfun));
  }
  }
  
Index: gcc/tree-ssa-sink.c
===
*** gcc/tree-ssa-sink.c.orig2011-03-09 17:57:48.0 +0100
--- gcc/tree-ssa-sink.c 2011-03-09 18:03:30.0 +0100
*** statement_sink_location (gimple stmt, ba
*** 268,274 
 gimple_stmt_iterator *togsi)
  {
gimple use;
-   tree def;
use_operand_p one_use = NULL_USE_OPERAND_P;
basic_block sinkbb;
use_operand_p use_p;
--- 268,273 
*** statement_sink_location (gimple stmt, ba
*** 276,299 
ssa_op_iter iter;
imm_use_iterator imm_iter;
  
!   FOR_EACH_SSA_TREE_OPERAND (def, stmt, iter, SSA_OP_ALL_DEFS)
! {
!   FOR_EACH_IMM_USE_FAST (one_use, imm_iter, def)
!   {
! if (is_gimple_debug (USE_STMT (one_use)))
!   continue;
! 
! break;
!   }
!   if (one_use != NULL_USE_OPERAND_P)
! break;
! }
  
!   /* Return if there are no immediate uses of this stmt.  */
!   if (one_use == NULL_USE_OPERAND_P)
  return false;
  
!   if (gimple_code (stmt) != GIMPLE_ASSIGN)
  return false;
  
/* There are a few classes of things we can't or don't move, some because we
--- 275,291 
ssa_op_iter iter;
imm_use_iterator imm_iter;
  
!   /* We only can sink assignments.  */
!   if (!is_gimple_assign (stmt))
! return false;
  
!   /* We only can sink stmts with a single definition.  */
!   def_p = single_ssa_def_operand (stmt, SSA_OP_ALL_DEFS);
!   if (def_p == NULL_DEF_OPERAND_P)
  return false;
  
!   /* Return if there are no immediate uses of this stmt.  */
!   if (has_zero_uses (DEF_FROM_PTR (def_p)))
  return false;
  
/* There are a few classes of things we can't or don't move, some because we
*** statement_sink_location (gimple stmt, ba
*** 323,342 
*/
if (stmt_ends_bb_p (stmt)
|| gimple_has_side_effects (stmt)
-   || is_hidden_global_store (stmt)
|| gimple_has_volatile_ops (stmt)
!   || gimple_vuse (stmt)
|| (cfun-has_local_explicit_reg_vars
   TYPE_MODE (TREE_TYPE (gimple_assign_lhs (stmt))) == BLKmode))
  return false;
  
!   FOR_EACH_SSA_DEF_OPERAND (def_p, stmt, iter, SSA_OP_ALL_DEFS)
! {
!   tree def = DEF_FROM_PTR (def_p);
!   if (is_global_var (SSA_NAME_VAR (def))
! || SSA_NAME_OCCURS_IN_ABNORMAL_PHI (def))
!   return false;
! }
  
FOR_EACH_SSA_USE_OPERAND (use_p, stmt, iter, SSA_OP_ALL_USES)
  {
--- 315,328 
*/
if (stmt_ends_bb_p 

[v3] Regenerate Solaris 2 baselines for GCC 4.6.0 release

2011-03-15 Thread Rainer Orth
I think we agreed that it would be useful to regenerate the Solaris 2
libstdc++ baselines close to the GCC 4.6.0 release, especially given
that symbol versioning on Solaris appears in 4.6.0 for the first time
and several symbols have been added to the libstdc++.so ABI since the
last update.

This patch does exactly that.  It is based on make new-abi-baseline
output across all of Solaris 8 to 11,  both SPARC and x86.  I'm
currently re-running bootstraps on all of them on both mainline and the
4.6 branch.

I'm only including one diff below, the others are identical (modulo
object sizes for the 64-bit ABIs).

The following functions/variables were added since the last update:

FUNC:std::regex_error::~regex_error()@@GLIBCXX_3.4.15
FUNC:std::regex_error::~regex_error()@@GLIBCXX_3.4.15
FUNC:std::regex_error::~regex_error()@@GLIBCXX_3.4.15
FUNC:std::bad_function_call::~bad_function_call()@@CXXABI_1.3.5
FUNC:std::bad_function_call::~bad_function_call()@@CXXABI_1.3.5
FUNC:std::__detail::_List_node_base::_M_reverse()@@GLIBCXX_3.4.15
FUNC:std::__detail::_List_node_base::_M_transfer(std::__detail::_List_node_base*,
 std::__detail::_List_node_base*)@@GLIBCXX_3.4.15
FUNC:std::__detail::_List_node_base::swap(std::__detail::_List_node_base, 
std::__detail::_List_node_base)@@GLIBCXX_3.4.15
FUNC:std::__detail::_List_node_base::_M_hook(std::__detail::_List_node_base*)@@GLIBCXX_3.4.15
FUNC:std::__detail::_List_node_base::_M_unhook()@@GLIBCXX_3.4.15
FUNC:std::__throw_regex_error(std::regex_constants::error_type)@@GLIBCXX_3.4.15
OBJECT:12:typeinfo for std::regex_error@@GLIBCXX_3.4.15
OBJECT:12:typeinfo for std::bad_function_call@@CXXABI_1.3.5
OBJECT:16:typeinfo name for std::regex_error@@GLIBCXX_3.4.15
OBJECT:1:std::placeholders::_1@@GLIBCXX_3.4.15
OBJECT:1:std::placeholders::_2@@GLIBCXX_3.4.15
OBJECT:1:std::placeholders::_3@@GLIBCXX_3.4.15
OBJECT:1:std::placeholders::_4@@GLIBCXX_3.4.15
OBJECT:1:std::placeholders::_5@@GLIBCXX_3.4.15
OBJECT:1:std::placeholders::_6@@GLIBCXX_3.4.15
OBJECT:1:std::placeholders::_7@@GLIBCXX_3.4.15
OBJECT:1:std::placeholders::_8@@GLIBCXX_3.4.15
OBJECT:1:std::placeholders::_9@@GLIBCXX_3.4.15
OBJECT:1:std::placeholders::_10@@GLIBCXX_3.4.15
OBJECT:1:std::placeholders::_11@@GLIBCXX_3.4.15
OBJECT:1:std::placeholders::_12@@GLIBCXX_3.4.15
OBJECT:1:std::placeholders::_13@@GLIBCXX_3.4.15
OBJECT:1:std::placeholders::_14@@GLIBCXX_3.4.15
OBJECT:1:std::placeholders::_15@@GLIBCXX_3.4.15
OBJECT:1:std::placeholders::_16@@GLIBCXX_3.4.15
OBJECT:1:std::placeholders::_17@@GLIBCXX_3.4.15
OBJECT:1:std::placeholders::_18@@GLIBCXX_3.4.15
OBJECT:1:std::placeholders::_19@@GLIBCXX_3.4.15
OBJECT:1:std::placeholders::_20@@GLIBCXX_3.4.15
OBJECT:1:std::placeholders::_21@@GLIBCXX_3.4.15
OBJECT:1:std::placeholders::_22@@GLIBCXX_3.4.15
OBJECT:1:std::placeholders::_23@@GLIBCXX_3.4.15
OBJECT:1:std::placeholders::_24@@GLIBCXX_3.4.15
OBJECT:1:std::placeholders::_25@@GLIBCXX_3.4.15
OBJECT:1:std::placeholders::_26@@GLIBCXX_3.4.15
OBJECT:1:std::placeholders::_27@@GLIBCXX_3.4.15
OBJECT:1:std::placeholders::_28@@GLIBCXX_3.4.15
OBJECT:1:std::placeholders::_29@@GLIBCXX_3.4.15
OBJECT:20:vtable for std::regex_error@@GLIBCXX_3.4.15
OBJECT:20:vtable for std::bad_function_call@@CXXABI_1.3.5
OBJECT:22:typeinfo name for std::bad_function_call@@CXXABI_1.3.5

Ok for both if the bootstraps pass?

Thanks.

Rainer


2011-03-15  Rainer Orth  r...@cebitec.uni-bielefeld.de

libstdc++-v3:
* config/abi/post/solaris2.8/baseline_symbols.txt: Regenerate.
* config/abi/post/solaris2.8/sparcv9/baseline_symbols.txt: Likewise.
* config/abi/post/solaris2.10/baseline_symbols.txt: Likewise.
* config/abi/post/solaris2.10/amd64/baseline_symbols.txt: Likewise.
* config/abi/post/solaris2.10/sparcv9/baseline_symbols.txt: Likewise.

diff -r 217519b21f20 
libstdc++-v3/config/abi/post/solaris2.8/baseline_symbols.txt
--- a/libstdc++-v3/config/abi/post/solaris2.8/baseline_symbols.txt  Fri Mar 
11 18:03:34 2011 +0100
+++ b/libstdc++-v3/config/abi/post/solaris2.8/baseline_symbols.txt  Tue Mar 
15 11:21:07 2011 +0100
@@ -1162,6 +1162,9 @@
 FUNC:_ZNSt11range_errorC2ERKSs@@GLIBCXX_3.4
 FUNC:_ZNSt11range_errorD0Ev@@GLIBCXX_3.4
 FUNC:_ZNSt11range_errorD1Ev@@GLIBCXX_3.4
+FUNC:_ZNSt11regex_errorD0Ev@@GLIBCXX_3.4.15
+FUNC:_ZNSt11regex_errorD1Ev@@GLIBCXX_3.4.15
+FUNC:_ZNSt11regex_errorD2Ev@@GLIBCXX_3.4.15
 FUNC:_ZNSt12__basic_fileIcE2fdEv@@GLIBCXX_3.4
 FUNC:_ZNSt12__basic_fileIcE4fileEv@@GLIBCXX_3.4.1
 FUNC:_ZNSt12__basic_fileIcE4openEPKcSt13_Ios_Openmodei@@GLIBCXX_3.4
@@ -1712,6 +1715,8 @@
 FUNC:_ZNSt17__timepunct_cacheIwED0Ev@@GLIBCXX_3.4
 FUNC:_ZNSt17__timepunct_cacheIwED1Ev@@GLIBCXX_3.4
 FUNC:_ZNSt17__timepunct_cacheIwED2Ev@@GLIBCXX_3.4
+FUNC:_ZNSt17bad_function_callD0Ev@@CXXABI_1.3.5
+FUNC:_ZNSt17bad_function_callD1Ev@@CXXABI_1.3.5
 FUNC:_ZNSt17moneypunct_bynameIcLb0EEC1EPKcj@@GLIBCXX_3.4
 FUNC:_ZNSt17moneypunct_bynameIcLb0EEC2EPKcj@@GLIBCXX_3.4
 FUNC:_ZNSt17moneypunct_bynameIcLb0EED0Ev@@GLIBCXX_3.4
@@ -1920,6 +1925,11 @@
 

Re: [patch gcc c++ c-family java fortan lto]: Fix DOS-filesystem issues

2011-03-15 Thread Pedro Alves
Thanks.

On Tuesday 15 March 2011 07:25:10, Kai Tietz wrote:
 @@ -989,6 +989,13 @@ handle_toplevel_file (directive_handler_
  
in_fname = read_md_filename;
lastsl = strrchr (in_fname, '/');
 +#ifdef HAVE_DOS_BASED_FILE_SYSTEM
 +  {
 +char *lsl2 = strrchr (in_fname, '\\');
 +if (!lastsl || (lsl2  lsl2  lastsl))
 +  lastsl = lsl2;
 +  }
 +#endif
if (lastsl != NULL)
  base_dir = xstrndup (in_fname, lastsl - in_fname + 1);
else

This looks like lbasename-able as well, getting rid of
that HAVE_DOS...-ish foo:

  base = lbasename (in_fname);
  if (base == in_fname)
base_dir = NULL;
  else
base_dir = xstrndup (in_fname, base - in_fname);

-- 
Pedro Alves


Re: [PATCH] Remove -fenable-icf-debug support

2011-03-15 Thread Rainer Orth
Hi Jakub,

 As Cary said there are no consumers of the .debug_dcall/.debug_vcall
 sections yet and DW_TAG_GNU_call_site info should contain a superset
 of that information, this patch removes -fenable-icf-debug support,
 if you think it is desirable to remove it.

this should also fix PR debug/47393.

Rainer

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


Re: [PATCH, ARM] Fix PR 43872, incorrectly aligned VLAs

2011-03-15 Thread Chung-Lin Tang
On 2011/3/15 02:41 PM, Ramana Radhakrishnan wrote:
 On 17/02/11 10:01, Chung-Lin Tang wrote:
 Hi,
 this PR is a case where we have a leaf function with a zero-size frame,
 that calls alloca() (here through a C99 VLA).

 The ARM backend recognizes the leaf-and-no-frame opportunity to save an
 unneeded stack alignment. But when calling alloca(), the allocated block
 is of BIGGEST_ALIGNMENT, which is 8-bytes under current AAPCS. Thus a
 stack align may still be needed to place the alloca() returned block
 properly.

 This patch adjusts the early return condition with !cfun-calls_alloca.
 Tested without regressions on ARM-Linux, okay for trunk?
 
 OK.

Thanks.


 Also related, the BIGGEST_ALIGNMENT defined for ARM is currently
 ABI-based; 64-bits for AAPCS targets, and 32 for old ABI.  Should this
 also consider arch-level as well? i.e. anything= ARMv5TE (with ldrd)
 should have this set to 64.
 
 I don't think it's that straightforward. The ABI specifies that an 8
 byte quantity must be aligned at 64 bit boundaries and this should be
 independent of architecture revisions. Think about pointers to 64 bit
 quantities passed from !(TARGET_LDRD) to TARGET_LDRD code or indeed
 creating structure layout issues between architecture revisions if you
 change this.

Oh okay, I see.  I checked again, originally thought that structure
layout was controlled by other alignment related macros...


[committed] Fix fallout from snprintf folding patch (PR tree-optimization/48129)

2011-03-15 Thread Jakub Jelinek
Hi!

On some targets implicit_built_in_decls[BUILT_IN_SNPRINTF] is NULL,
but as we want only the return type of the snprintf function
and fold_builtin_snprintf in that case is only used when
__builtin_* variant is used explicitly, using built_in_decls
is better and avoids the ICE.

Bootstrapped/regtested on x86_64-linux and i686-linux, tested
on the testcase with cross to cris-elf, committed to trunk
as obvious.

2011-03-15  Jakub Jelinek  ja...@redhat.com

PR tree-optimization/48129
* builtins.c (fold_builtin_snprintf): Convert to type of
built_in_decls[BUILT_IN_SNPRINTF] retval instead of
implicit_built_in_decls[BUILT_IN_SNPRINTF] retval.

--- gcc/builtins.c.jj   2011-03-15 09:47:12.0 +0100
+++ gcc/builtins.c  2011-03-15 10:05:25.0 +0100
@@ -12038,9 +12038,8 @@ fold_builtin_snprintf (location_t loc, t
 
   if (call  retval)
 {
-  retval = fold_convert_loc
-   (loc, TREE_TYPE (TREE_TYPE 
(implicit_built_in_decls[BUILT_IN_SNPRINTF])),
-retval);
+  tree fn = built_in_decls[BUILT_IN_SNPRINTF];
+  retval = fold_convert_loc (loc, TREE_TYPE (TREE_TYPE (fn)), retval);
   return build2 (COMPOUND_EXPR, TREE_TYPE (retval), call, retval);
 }
   else

Jakub


Re: [v3] typeinfo tuning

2011-03-15 Thread Jonathan Wakely
On 14 March 2011 17:29, Benjamin Kosnik wrote:

 I hacked up scripts/check_compile and ran the libstdc++ testsuite to
 generate 4k+ .s files, and then analyzed the resulting assembly files
 for vague linkage.

 Here are the clear wins that are ABI-compatible, or in C++0x code. There
 are other issues, like the locale base classes, that are not as easy to
 fix. There are a couple other issues in C++0x code that I am working
 out, will post later today.

 I'm holding off on this patch until branching is clear. But I thought
 I'd post it so that this effort is public. It's set up for 4.6.0 but
 may be moved to 4.7.0.

Does exporting some of these symbols and vtables from the library mean
we're less able to change them?  I'm not confident all ofthe C++0x
bits are entirely stable yet.

I see you've given future_base::_Result_base a virtual destructor, is
there a specific reason for that?  Destruction should always be via
the virtual _M_destroy function and so 'delete' is called in the final
overrider, where the static type and dynamic type are the same. The
virtual destructor adds unnecessary overhead, though it's probably
negligible.


Re: [patch gcc c++ c-family java fortan lto]: Fix DOS-filesystem issues

2011-03-15 Thread Kai Tietz
2011/3/15 Pedro Alves pe...@codesourcery.com:
 Thanks.

 This looks like lbasename-able as well, getting rid of
 that HAVE_DOS...-ish foo:

Thanks. Yes, that one I missed.

Attached updated version of patch.

Kai
Index: gcc/gcc/c-family/c-ada-spec.c
===
--- gcc.orig/gcc/c-family/c-ada-spec.c  2011-03-14 18:45:20.566392100 +0100
+++ gcc/gcc/c-family/c-ada-spec.c   2011-03-14 20:22:19.023299300 +0100
@@ -559,7 +559,8 @@ compare_comment (const void *lp, const v
   const cpp_comment *rhs = (const cpp_comment *) rp;
 
   if (LOCATION_FILE (lhs-sloc) != LOCATION_FILE (rhs-sloc))
-return strcmp (LOCATION_FILE (lhs-sloc), LOCATION_FILE (rhs-sloc));
+return filename_cmp (LOCATION_FILE (lhs-sloc),
+LOCATION_FILE (rhs-sloc));
 
   if (LOCATION_LINE (lhs-sloc) != LOCATION_LINE (rhs-sloc))
 return LOCATION_LINE (lhs-sloc) - LOCATION_LINE (rhs-sloc);
Index: gcc/gcc/collect2.c
===
--- gcc.orig/gcc/collect2.c 2011-03-14 18:45:20.567392100 +0100
+++ gcc/gcc/collect2.c  2011-03-15 07:57:54.540718100 +0100
@@ -30,6 +30,7 @@ along with GCC; see the file COPYING3.
 #include system.h
 #include coretypes.h
 #include tm.h
+#include filenames.h
 
 /* TARGET_64BIT may be defined to use driver specific functionality. */
 #undef TARGET_64BIT
@@ -2314,12 +2315,8 @@ write_c_file_stat (FILE *stream, const c
   int frames = (frame_tables.number  0);
 
   /* Figure out name of output_file, stripping off .so version.  */
-  p = strrchr (output_file, '/');
-  if (p == 0)
-p = output_file;
-  else
-p++;
-  q = p;
+  q = p = lbasename (output_file);
+
   while (q)
 {
   q = strchr (q,'.');
@@ -2330,7 +2327,7 @@ write_c_file_stat (FILE *stream, const c
}
   else
{
- if (strncmp (q, SHLIB_SUFFIX, strlen (SHLIB_SUFFIX)) == 0)
+ if (filename_ncmp (q, SHLIB_SUFFIX, strlen (SHLIB_SUFFIX)) == 0)
{
  q += strlen (SHLIB_SUFFIX);
  break;
@@ -3192,10 +3189,10 @@ resolve_lib_name (const char *name)
   for (; list; list = list-next)
{
  /* The following lines are needed because path_prefix list
-may contain directories both with trailing '/' and
+may contain directories both with trailing DIR_SEPARATOR and
 without it.  */
  const char *p = ;
- if (list-prefix[strlen(list-prefix)-1] != '/')
+ if (!IS_DIR_SEPARATOR (list-prefix[strlen(list-prefix)-1]))
p = /;
  for (j = 0; j  2; j++)
{
Index: gcc/gcc/coverage.c
===
--- gcc.orig/gcc/coverage.c 2011-03-14 18:45:20.569392100 +0100
+++ gcc/gcc/coverage.c  2011-03-14 18:45:52.497503800 +0100
@@ -49,6 +49,7 @@ along with GCC; see the file COPYING3.
 #include tree-pass.h
 #include diagnostic-core.h
 #include intl.h
+#include filenames.h
 
 #include gcov-io.c
 
@@ -982,7 +983,7 @@ coverage_init (const char *filename)
   /* + 1 for extra '/', in case prefix doesn't end with /.  */
   int prefix_len;
 
-  if (profile_data_prefix == 0  filename[0] != '/')
+  if (profile_data_prefix == 0  !IS_ABSOLUTE_PATH(filename[0]))
 profile_data_prefix = getpwd ();
 
   prefix_len = (profile_data_prefix) ? strlen (profile_data_prefix) + 1 : 0;
Index: gcc/gcc/fortran/scanner.c
===
--- gcc.orig/gcc/fortran/scanner.c  2011-03-14 18:45:20.588392100 +0100
+++ gcc/gcc/fortran/scanner.c   2011-03-14 18:45:52.506505000 +0100
@@ -1754,7 +1754,7 @@ preprocessor_line (gfc_char_t *c)
   if (flag[2]) /* Ending current file.  */
 {
   if (!current_file-up
- || strcmp (current_file-up-filename, filename) != 0)
+ || filename_cmp (current_file-up-filename, filename) != 0)
{
  gfc_warning_now (%s:%d: file %s left but not entered,
   current_file-filename, current_file-line,
@@ -1774,7 +1774,7 @@ preprocessor_line (gfc_char_t *c)
   /* The name of the file can be a temporary file produced by
  cpp. Replace the name if it is different.  */
 
-  if (strcmp (current_file-filename, filename) != 0)
+  if (filename_cmp (current_file-filename, filename) != 0)
 {
/* FIXME: we leak the old filename because a pointer to it may be stored
   in the linemap.  Alternative could be using GC or updating linemap to
@@ -1891,7 +1891,7 @@ load_file (const char *realfilename, con
   filename = displayedname ? displayedname : realfilename;
 
   for (f = current_file; f; f = f-up)
-if (strcmp (filename, f-filename) == 0)
+if (filename_cmp (filename, f-filename) == 0)
   {
fprintf (stderr, %s:%d: Error: File '%s' is being included 
 recursively\n, current_file-filename, current_file-line,
Index: gcc/gcc/gcc.c

[PATCH] Fix part of PR48037

2011-03-15 Thread Richard Guenther

This avoids spilling SSE registers to memory just because we access
vector components in a C array way.  The trick is to simply rewrite
those accesses to proper vector selects on the tree level and promote
the vector to SSA form.

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

Richard.

2011-03-15  Richard Guenther  rguent...@suse.de

PR tree-optimization/48037
* tree-ssa.c (maybe_rewrite_mem_ref_base): Rewrite vector
selects into BIT_FIELD_REFs.
(non_rewritable_mem_ref_base): Check if a MEM_REF is a
vector select.

* gcc.target/i386/pr48037-1.c: New testcase.

Index: gcc/tree-ssa.c
===
*** gcc/tree-ssa.c  (revision 170776)
--- gcc/tree-ssa.c  (working copy)
*** maybe_rewrite_mem_ref_base (tree *tp)
*** 1838,1855 
  tp = TREE_OPERAND (*tp, 0);
if (TREE_CODE (*tp) == MEM_REF
 TREE_CODE (TREE_OPERAND (*tp, 0)) == ADDR_EXPR
-integer_zerop (TREE_OPERAND (*tp, 1))
 (sym = TREE_OPERAND (TREE_OPERAND (*tp, 0), 0))
 DECL_P (sym)
 !TREE_ADDRESSABLE (sym)
 symbol_marked_for_renaming (sym))
  {
!   if (!useless_type_conversion_p (TREE_TYPE (*tp),
! TREE_TYPE (sym)))
!   *tp = build1 (VIEW_CONVERT_EXPR,
!   TREE_TYPE (*tp), sym);
!   else
!   *tp = sym;
  }
  }
  
--- 1838,1869 
  tp = TREE_OPERAND (*tp, 0);
if (TREE_CODE (*tp) == MEM_REF
 TREE_CODE (TREE_OPERAND (*tp, 0)) == ADDR_EXPR
 (sym = TREE_OPERAND (TREE_OPERAND (*tp, 0), 0))
 DECL_P (sym)
 !TREE_ADDRESSABLE (sym)
 symbol_marked_for_renaming (sym))
  {
!   if (TREE_CODE (TREE_TYPE (sym)) == VECTOR_TYPE
!  useless_type_conversion_p (TREE_TYPE (*tp),
!   TREE_TYPE (TREE_TYPE (sym)))
!  multiple_of_p (sizetype, TREE_OPERAND (*tp, 1),
!   TYPE_SIZE_UNIT (TREE_TYPE (*tp
!   {
! *tp = build3 (BIT_FIELD_REF, TREE_TYPE (*tp), sym, 
!   TYPE_SIZE (TREE_TYPE (*tp)),
!   int_const_binop (MULT_EXPR,
!bitsize_int (BITS_PER_UNIT),
!TREE_OPERAND (*tp, 1), 0));
!   }
!   else if (integer_zerop (TREE_OPERAND (*tp, 1)))
!   {
! if (!useless_type_conversion_p (TREE_TYPE (*tp),
! TREE_TYPE (sym)))
!   *tp = build1 (VIEW_CONVERT_EXPR,
! TREE_TYPE (*tp), sym);
! else
!   *tp = sym;
!   }
  }
  }
  
*** non_rewritable_mem_ref_base (tree ref)
*** 1869,1879 
  base = TREE_OPERAND (base, 0);
  
/* But watch out for MEM_REFs we cannot lower to a
!  VIEW_CONVERT_EXPR.  */
if (TREE_CODE (base) == MEM_REF
 TREE_CODE (TREE_OPERAND (base, 0)) == ADDR_EXPR)
  {
tree decl = TREE_OPERAND (TREE_OPERAND (base, 0), 0);
if (DECL_P (decl)
   (!integer_zerop (TREE_OPERAND (base, 1))
  || (DECL_SIZE (decl)
--- 1883,1900 
  base = TREE_OPERAND (base, 0);
  
/* But watch out for MEM_REFs we cannot lower to a
!  VIEW_CONVERT_EXPR or a BIT_FIELD_REF.  */
if (TREE_CODE (base) == MEM_REF
 TREE_CODE (TREE_OPERAND (base, 0)) == ADDR_EXPR)
  {
tree decl = TREE_OPERAND (TREE_OPERAND (base, 0), 0);
+   if (TREE_CODE (TREE_TYPE (decl)) == VECTOR_TYPE
+  useless_type_conversion_p (TREE_TYPE (base),
+   TREE_TYPE (TREE_TYPE (decl)))
+  double_int_fits_in_uhwi_p (mem_ref_offset (base))
+  multiple_of_p (sizetype, TREE_OPERAND (base, 1),
+   TYPE_SIZE_UNIT (TREE_TYPE (base
+   return NULL_TREE;
if (DECL_P (decl)
   (!integer_zerop (TREE_OPERAND (base, 1))
  || (DECL_SIZE (decl)
Index: gcc/testsuite/gcc.target/i386/pr48037-1.c
===
*** gcc/testsuite/gcc.target/i386/pr48037-1.c   (revision 0)
--- gcc/testsuite/gcc.target/i386/pr48037-1.c   (revision 0)
***
*** 0 
--- 1,15 
+ /* { dg-do compile } */
+ /* { dg-require-effective-target lp64 } */
+ /* { dg-options -O -fno-math-errno } */
+ 
+ typedef double __m128d __attribute__((vector_size(16)));
+ __m128d vsqrt1 (__m128d const x)
+ {
+   double const* __restrict__ const y = (double const*)x;
+   double const a = __builtin_sqrt(y[0]);
+   double const b = __builtin_sqrt(y[1]);
+   return (__m128d) { a, b };
+ }
+ 
+ /* Verify we do not spill x to the stack.  */
+ /* { dg-final { scan-assembler-not %rsp } } */


[google] XFAIL execution of libmudflap.c/pass49-frag.c (issue4278049)

2011-03-15 Thread Diego Novillo

When I XFAIL'd this test, I forgot to XFAIL its execution as well.

Tested on x86_64.  Committed to branch.

2011-03-15  Diego Novillo  dnovi...@google.com

* testsuite/libmudflap.c/pass49-frag.c: Also XFAIL
execution.

Index: libmudflap/testsuite/libmudflap.c/pass49-frag.c
===
--- libmudflap/testsuite/libmudflap.c/pass49-frag.c (revision 170968)
+++ libmudflap/testsuite/libmudflap.c/pass49-frag.c (working copy)
@@ -1,4 +1,4 @@
-/* { dg-do run } */
+/* { dg-do run  { xfail *-*-* } } */
 #include stdlib.h
 #include ctype.h
 #include stdarg.h

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


Fix PR 45844, gfortran.dg/vect/pr45714-b.f ICE on power7

2011-03-15 Thread Alan Modra
The vsx splat load from memory insns manage to evade
reg_offset_addressing_ok_p since their MEM mode is DFmode or DImode,
which are not (usually) vector modes.  This patch prevents reload
damage in rs6000_legitimize_reload_address, and ensures the splat insn
predicate is sufficiently strict.  Bootstrapped etc. powerpc64-linux
on power7 hardware.  OK to apply?

PR target/45844
* config/rs6000/rs6000.c (rs6000_legitimize_reload_address): Don't
create invalid offset address for vsx splat insn.
* config/rs6000/predicates.md (splat_input_operand): New.
* config/rs6000/vsx.md (vsx_splat_*): Use it.

Index: gcc/config/rs6000/rs6000.c
===
--- gcc/config/rs6000/rs6000.c  (revision 170978)
+++ gcc/config/rs6000/rs6000.c  (working copy)
@@ -6579,6 +6676,14 @@ rs6000_legitimize_reload_address (rtx x,
 {
   bool reg_offset_p = reg_offset_addressing_ok_p (mode);
 
+  /* Nasty hack for vsx_splat_V2DF/V2DI load from mem, which takes a
+ DFmode/DImode MEM.  */
+  if (reg_offset_p
+   opnum == 1
+   ((mode == DFmode  recog_data.operand_mode[0] == V2DFmode)
+ || (mode == DImode  recog_data.operand_mode[0] == V2DImode)))
+reg_offset_p = false;
+
   /* We must recognize output that we have already generated ourselves.  */
   if (GET_CODE (x) == PLUS
GET_CODE (XEXP (x, 0)) == PLUS
Index: gcc/config/rs6000/predicates.md
===
--- gcc/config/rs6000/predicates.md (revision 170978)
+++ gcc/config/rs6000/predicates.md (working copy)
@@ -871,6 +871,23 @@ (define_predicate input_operand
   return 0;
 })
 
+;; Return 1 if this operand is a valid input for a vsx_splat insn.
+(define_predicate splat_input_operand
+  (match_code label_ref,symbol_ref,const,high,reg,subreg,mem,
+  const_double,const_vector,const_int,plus)
+{
+  if (MEM_P (op))
+{
+  if (mode == DFmode)
+   mode = V2DFmode;
+  else if (mode == DImode)
+   mode = V2DImode;
+  else
+   gcc_unreachable ();
+}
+  return input_operand (op, mode);
+})
+
 ;; Return true if OP is an invalid SUBREG operation on the e500.
 (define_predicate rs6000_nonimmediate_operand
   (match_code reg,subreg,mem)
Index: gcc/config/rs6000/vsx.md
===
--- gcc/config/rs6000/vsx.md(revision 170978)
+++ gcc/config/rs6000/vsx.md(working copy)
@@ -1076,7 +1076,7 @@ (define_insn *vsx_xxpermdi2_mode
 (define_insn vsx_splat_mode
   [(set (match_operand:VSX_D 0 vsx_register_operand =wd,wd,wd,?wa,?wa,?wa)
(vec_duplicate:VSX_D
-(match_operand:VS_scalar 1 input_operand ws,f,Z,wa,wa,Z)))]
+(match_operand:VS_scalar 1 splat_input_operand ws,f,Z,wa,wa,Z)))]
   VECTOR_MEM_VSX_P (MODEmode)
   @
xxpermdi %x0,%x1,%x1,0

-- 
Alan Modra
Australia Development Lab, IBM


Re: ivopts improvement

2011-03-15 Thread Tom de Vries
Hi Zdenek,

I rewrote the patch to remove the use of use_uses_inced_iv.

On 03/14/2011 03:03 PM, Zdenek Dvorak wrote:
 Hi,
 
 (since the use_uses_inced_iv test is meaningless).

 To me it seems use_uses_inced_iv has meaning:
 - it models something: it states whether the comparison is using
   the iv increment result or the iv phi result.
 
 but that has nothing to do with the value of the iv.  For instance,
 in the following:
 
 a = phi (0, a')
 b = phi (1, b')
 c = phi (1, c')
 
 a' = a + 1;
 tmp = b;
 
 compare (a'/tmp/c, something)
 
 b' = tmp + 1;
 c' = c + 1;
 
 a', tmp and c are completely equivalent, yet your code for some reason claims
 to handle c and the other two differently.

That a' and c have the same value and the code handles them differently
does not necessarily mean that the code is incorrect.  The way I would
formulate it is that the code has implementation limitations, which are
expressed in an awkward way.

 tmp = b;

You're right, the calculation of use_uses_inced_iv assumed that it looks
at either the iv phi or the iv increment, so that was not safe.


I'll try to explain what my intention with the code is, by looking at a
pre-ivopt level example.

bb 2:
  p_5 = p_3(D) + i_4(D);

bb 3:
  # p_1 = PHI p_5(2), p_6(4)
  # i_2 = PHI i_4(D)(2), i_7(4)
  *p_1 = 0;
  p_6 = p_1 + 1;
  i_7 = i_2 + 1;
  if (i_7  n_8(D))
goto bb 4;
  else
goto bb 5;

bb 4:
  goto bb 3;

bb 5:
  return;

In this example, I try to analyze whether it is safe to replace
  i_7  n_8
by
  p_6  p_3 + n_8.

What I tried to do previously was to first prove a relation p_1 == i_2 +
ssa_name between i_2 and p_1, and then figure out (in the awkward code)
if I was allowed to assume p_6 == i_7 + ssa_name.

Now, I try to prove that relation between i_7 and p_6 instead, which
makes the code in iv_elimination_compare_lt simpler.

This has as casualty though that the 'int' case (the case that use-iv
is not compatible with sizetype) does not work anymore. That would need
more work.

The code still has the same limitation, meaning it will transform the
first 2 examples, but not the last 2 examples of the series of 4
mentioned earlier.

Changes compared to previous submission:
- changed name of fold_walk_def_plus into fold_diff_to_ssa_name
- added extra intelligence in fold_diff_to_ssa_name to deal with
  (a + x) - (b - x).
- don't calculate real_iv_use_base, calculate instead base_cand_at_use
  to simplify code

Thanks,
-Tom
diff -u gcc/tree-ssa-loop-ivopts.c gcc/tree-ssa-loop-ivopts.c
--- gcc/tree-ssa-loop-ivopts.c	(working copy)
+++ gcc/tree-ssa-loop-ivopts.c	(working copy)
@@ -419,6 +419,89 @@
   return fold_build2 (code, TREE_TYPE (a), a, b);
 }
 
+/* Folds (TREE_TYPE (A))(A CODE B), where CODE is either PLUS_EXPR or
+   MINUS_EXPR.  Returns the folded expression if folding is successful.
+   Otherwise, return NULL_TREE.  Handles the case that A is a pointer
+   robustly.  */
+
+static inline tree
+fold_plus (enum tree_code code, tree a, tree b)
+{
+  tree a_type = TREE_TYPE (a);
+  tree res;
+
+  STRIP_NOPS (a);
+  robust_plus (code, a, b);
+
+  res = fold_binary (code, TREE_TYPE (a), a, b);
+  if (res == NULL_TREE)
+return NULL_TREE;
+
+  return fold_convert (a_type, res);
+}
+
+/* Folds (TREE_TYPE (A))(A - B), possibly using the defining stmt of A.  Returns
+   the folded expression if folding is successful and resulted in an ssa_name.
+   Otherwise, return NULL_TREE.  */
+
+static inline tree
+fold_diff_to_ssa_name (tree a, tree b)
+{
+  tree a_type = TREE_TYPE (a);
+  tree res, a0, a1;
+  gimple def_stmt;
+
+  res = fold_plus (MINUS_EXPR, a, b);
+  if (res != NULL_TREE)
+{
+  STRIP_NOPS (res);
+  if (TREE_CODE (res) == SSA_NAME)
+	return fold_convert (a_type, res);
+}
+
+  STRIP_NOPS (a);
+  STRIP_NOPS (b);
+
+  if (TREE_CODE (a) == PLUS_EXPR  TREE_CODE (b) == PLUS_EXPR
+   TREE_OPERAND (a, 1) == TREE_OPERAND (b, 1))
+{
+  a = TREE_OPERAND (a, 0);
+  b = TREE_OPERAND (b, 0);
+
+  STRIP_NOPS (a);
+  STRIP_NOPS (b);
+
+  res = fold_plus (MINUS_EXPR, a, b);
+  if (res != NULL_TREE)
+	{
+	  STRIP_NOPS (res);
+	  if (TREE_CODE (res) == SSA_NAME)
+	return fold_convert (a_type, res);
+	}
+}
+
+  if (TREE_CODE (a) != SSA_NAME)
+return NULL_TREE;
+
+  def_stmt = SSA_NAME_DEF_STMT (a);
+  if (!is_gimple_assign (def_stmt)
+  || (gimple_assign_rhs_code (def_stmt) != PLUS_EXPR
+	   gimple_assign_rhs_code (def_stmt) != POINTER_PLUS_EXPR))
+return NULL_TREE;
+  a0 = gimple_assign_rhs1 (def_stmt);
+  a1 = gimple_assign_rhs2 (def_stmt);
+
+  res = fold_plus (MINUS_EXPR, fold_build_plus (PLUS_EXPR, a0, a1), b);
+  if (res != NULL_TREE)
+{
+  STRIP_NOPS (res);
+  if (TREE_CODE (res) == SSA_NAME)
+	return fold_convert (a_type, res);
+}
+
+  return NULL_TREE;
+}
+
 /* Number of uses recorded in DATA.  */
 
 static inline unsigned
@@ -825,17 +908,25 @@
 
   if (!slot)
 {
-  /* Try to determine number of iterations.  We must know it
-	 

C++0x PATCH to implement core 1191 (deleted base destructor)

2011-03-15 Thread Jason Merrill
This patch implements the proposed resolution for core issue 1191: base 
destructors do not affect the triviality of derived constructors, but 
they do affect the exception specification and deletedness.


Tested x86_64-pc-linux-gnu, applying to trunk.
commit 15e4a01c978314724435064f20c373abf7a1bf8c
Author: Jason Merrill ja...@redhat.com
Date:   Sun Jan 23 17:52:44 2011 -0500

Core 1191
* method.c (synthezized_method_walk): Cleanups don't affect the
triviality of a constructor, but do affect deletion and exception
specification.

diff --git a/gcc/cp/method.c b/gcc/cp/method.c
index d70da95..0366988 100644
--- a/gcc/cp/method.c
+++ b/gcc/cp/method.c
@@ -1080,14 +1080,9 @@ synthesized_method_walk (tree ctype, 
special_function_kind sfk, bool const_p,
   tsubst_flags_t complain;
   const char *msg;
   bool ctor_p;
-  tree cleanup_spec;
-  bool cleanup_trivial = true;
-  bool cleanup_deleted = false;
 
-  cleanup_spec
-= (cxx_dialect = cxx0x ? noexcept_true_spec : empty_except_spec);
   if (spec_p)
-*spec_p = cleanup_spec;
+*spec_p = (cxx_dialect = cxx0x ? noexcept_true_spec : empty_except_spec);
 
   if (deleted_p)
 {
@@ -1228,8 +1223,10 @@ synthesized_method_walk (tree ctype, 
special_function_kind sfk, bool const_p,
 destructors for cleanup of partially constructed objects.  */
  rval = locate_fn_flags (base_binfo, complete_dtor_identifier,
  NULL_TREE, flags, complain);
- process_subob_fn (rval, false, cleanup_spec, cleanup_trivial,
-   cleanup_deleted, NULL, NULL,
+ /* Note that we don't pass down trivial_p; the subobject
+destructors don't affect triviality of the constructor.  */
+ process_subob_fn (rval, false, spec_p, NULL,
+   deleted_p, NULL, NULL,
basetype);
}
 
@@ -1275,8 +1272,8 @@ synthesized_method_walk (tree ctype, 
special_function_kind sfk, bool const_p,
{
  rval = locate_fn_flags (base_binfo, complete_dtor_identifier,
  NULL_TREE, flags, complain);
- process_subob_fn (rval, false, cleanup_spec, cleanup_trivial,
-   cleanup_deleted, NULL, NULL,
+ process_subob_fn (rval, false, spec_p, NULL,
+   deleted_p, NULL, NULL,
basetype);
}
}
@@ -1295,23 +1292,14 @@ synthesized_method_walk (tree ctype, 
special_function_kind sfk, bool const_p,
   if (ctor_p)
 walk_field_subobs (TYPE_FIELDS (ctype), complete_dtor_identifier,
   sfk_destructor, TYPE_UNQUALIFIED, false,
-  false, false, cleanup_spec, cleanup_trivial,
-  cleanup_deleted, NULL,
+  false, false, spec_p, NULL,
+  deleted_p, NULL,
   NULL, flags, complain);
 
   pop_scope (scope);
 
   --cp_unevaluated_operand;
   --c_inhibit_evaluation_warnings;
-
-  /* If the constructor isn't trivial, consider the subobject cleanups.  */
-  if (ctor_p  trivial_p  !*trivial_p)
-{
-  if (deleted_p  cleanup_deleted)
-   *deleted_p = true;
-  if (spec_p)
-   *spec_p = merge_exception_specifiers (*spec_p, cleanup_spec);
-}
 }
 
 /* DECL is a deleted function.  If it's implicitly deleted, explain why and
diff --git a/gcc/testsuite/g++.dg/cpp0x/implicit11.C 
b/gcc/testsuite/g++.dg/cpp0x/implicit11.C
new file mode 100644
index 000..7ec8e95
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/implicit11.C
@@ -0,0 +1,17 @@
+// Test that we consider base dtors in determining whether
+// a derived ctor is deleted even if the ctor is trivial.
+// { dg-options -std=c++0x }
+
+struct A
+{
+  ~A() = delete;   // { dg-error declared here }
+};
+
+struct B: A { };   // { dg-error deleted }
+
+extern B eb;
+int main()
+{
+  B* b1 = new B;   // { dg-error use of deleted function  { 
xfail *-*-* } }
+  B* b2 = new B(eb);   // { dg-error use of deleted function }
+}


Re: [PATCH gcc/fortran] get rid of gfc_free

2011-03-15 Thread Jim Meyering
Janne Blomqvist wrote:
...
 Hi Janne,

 These requested changes are in addition to (and independent of)
 the changes that I've already posted here.

 Yes, it was perhaps a bit unreasonable to ask you to fix this. OTOH
 with your changes gfc_free() was just a wrapper around free() and
 should thus be removed as unnecessary. Also, I believe this proper
 fix is more in the spirit of the request by Tobias and the message he
 linked to discussing the removal of gfc_free().

 The first cset below
 does your #2 and #3, and the second does #1.  I separate them for
 review because #1 is completely mechanical, while the others
 are manual.  You may prefer to combine them before pushing, for
 bisection.  Let me know if you'd prefer I submit in that form.

 All 3 changesets are ok for 4.7.

 I think it's fine to commit them separately if you prefer. If so,
 preferably in the order #3, #1, #2 in order to keep every revision
 buildable.

 Thanks for working on this!

Just so we're clear...
Currently while I do have a sourceware account,
I'm not in the gcc group, so don't have commit access,

sourceware$ id -a|grep gcc
[Exit 1]

so someone else would have to commit my changes.
Or add me to the gcc group and I will do it.

Another recently-approved change may be in limbo for this reason:

avoid memory overrun in a test leading to potential double-free
* testsuite/test-expandargv.c (writeout_test): Fix off-by-one error:
i.e., do copy the trailing NUL byte.


Re: [PATCH][bug 48123] Install cpu_defines.h for freestanding C++ library.

2011-03-15 Thread Paolo Carlini

Hi,

Hi,

 This patch fixes the problem in bug 48123.  The problem is that
some headers include c++config.h, which in turn includes cpu_defines.h
but cpu_defines.h is not installed.  This has been broken for a long
time.  Patch was tested by bootstrapping on x86_64 and building a
cross-gcc for arm-linux-gnueabi in freestanding mode.
unless either Jakub, the release managers, or the libstdc++ maintainers 
manifest contrary opinions over the next few hours, I say Ok both 
mainline and 4_6-branch.


Paolo.


Re: [v3] Regenerate Solaris 2 baselines for GCC 4.6.0 release

2011-03-15 Thread Benjamin Kosnik

 I think we agreed that it would be useful to regenerate the Solaris 2
 libstdc++ baselines close to the GCC 4.6.0 release, especially given
 that symbol versioning on Solaris appears in 4.6.0 for the first time
 and several symbols have been added to the libstdc++.so ABI since the
 last update.

I agree we should do this for 4.6.0, but I disagree as to what the
exact exports should be.

-benjamin


Re: [v3] Regenerate Solaris 2 baselines for GCC 4.6.0 release

2011-03-15 Thread Benjamin Kosnik

 The lines in question are
 
 ##_ZTISt16nested_exception (glob)
 _ZTISt16nested_exception;
 ##_ZTSSt16nested_exception (glob)
 _ZTSSt16nested_exception;
 ##_ZTVSt16nested_exception (glob)
 _ZTVSt16nested_exception;
 
 in CXXABI_1.3.5, but the same symbols are also matched by
 
 ##_ZTISt[0-9][0-9][m-q]* (glob)
 ##_ZTSSt[0-9][0-9][m-q]* (glob)
 ##_ZTVSt[0-9][0-9][m-q]* (glob)
 
 in GLIBCXX_3.4.  I fear that I need to update contrib/make_sunver.pl
 to handle this, but would need to know the exact semantics of such a
 version script first.

Here's a patch that makes this exports crystal clear. 

FWIW, the linux exports for these nested_exception symbols were in
GLIBCXX_3.15 which was correct. This is still the case, even with the
explicit carve-outs in the patch below.

I've also changed the bad_function_call exports to not be in libsupc++,
or the freestanding version. (ie to GLIBCXX from CXXABI). I think this
was probably a simple thinko, right Paolo? If it's not, I'm not sure of
the rationale and would appreciate any commentary.

best,
benjamin2011-03-15  Benjamin Kosnik  b...@redhat.com

	* config/abi/pre/gnu.ver: Make nested_exception exports super clear.
	Move bad_function_call exports from CXXABI_1.3.5 to GLIBCXX_3.4.15.

Index: config/abi/pre/gnu.ver
===
--- config/abi/pre/gnu.ver	(revision 171002)
+++ config/abi/pre/gnu.ver	(working copy)
@@ -618,7 +618,10 @@
 _ZTVSt[0-9][0-9][g-k]*;
 _ZTVSt11logic_error;
 _ZTVSt12length_error;
-_ZTVSt[0-9][0-9][m-q]*;
+#   _ZTVSt[0-9][0-9][m-q]*;
+_ZTVSt[0-9][0-9][m]*;
+_ZTVSt[0-9][0-9]n[^e]*;
+_ZTVSt[0-9][0-9][o-q]*;
 _ZTVSt11range_error;
 _ZTVSt13runtime_error;
 _ZTVSt[0-9][0-9][t-z]*;
@@ -648,7 +651,10 @@
 _ZTISt[0-9][0-9][g-k]*;
 _ZTISt11logic_error;
 _ZTISt12length_error;
-_ZTISt[0-9][0-9][m-q]*;
+#   _ZTISt[0-9][0-9][m-q]*;
+_ZTISt[0-9][0-9][m]*;
+_ZTISt[0-9][0-9]n[^e]*;
+_ZTISt[0-9][0-9][o-q]*;
 _ZTISt11range_error;
 _ZTISt13runtime_error;
 _ZTISt[0-9][0-9][t-z]*;
@@ -682,7 +688,10 @@
 _ZTSSt[0-9][0-9][g-k]*;
 _ZTSSt11logic_error;
 _ZTSSt12length_error;
-_ZTSSt[0-9][0-9][m-q]*;
+#   _ZTSSt[0-9][0-9][m-q]*;
+_ZTSSt[0-9][0-9][m]*;
+_ZTSSt[0-9][0-9]n[^e]*;
+_ZTSSt[0-9][0-9][o-q]*;
 _ZTSSt11range_error;
 _ZTSSt13runtime_error;
 _ZTSSt[0-9][0-9][t-z]*;
@@ -1219,12 +1228,19 @@
 _ZTISt11regex_error;
 _ZSt19__throw_regex_errorNSt15regex_constants10error_typeE;
 
+# std::bad_weak_ptr
 _ZNSt12bad_weak_ptrD*;
 _ZNKSt12bad_weak_ptr4whatEv;
 _ZTSSt12bad_weak_ptr;
 _ZTVSt12bad_weak_ptr;
 _ZTISt12bad_weak_ptr;
 
+# std::bad_function_call
+_ZNSt17bad_function_callD*;
+_ZTISt17bad_function_call;
+_ZTSSt17bad_function_call;
+_ZTVSt17bad_function_call;
+
 _ZNSt14error_categoryC*;
 _ZNSt14error_categoryD*;
 
@@ -1422,12 +1438,6 @@
 # FNV hash.
 _ZSt15_Fnv_hash_bytesPKv*;
 
-# std::bad_function_call.
-_ZNSt17bad_function_callD*;
-_ZTISt17bad_function_call;
-_ZTSSt17bad_function_call;
-_ZTVSt17bad_function_call;
-
 # std::nested_exception
 _ZNSt16nested_exceptionD*;
 _ZTISt16nested_exception;


Re: [v3] Regenerate Solaris 2 baselines for GCC 4.6.0 release

2011-03-15 Thread Paolo Carlini

On 03/15/2011 08:05 PM, Benjamin Kosnik wrote:

I've also changed the bad_function_call exports to not be in libsupc++,
or the freestanding version. (ie to GLIBCXX from CXXABI). I think this
was probably a simple thinko, right Paolo?
Yes, as far as I can see now. Sorry about that and thanks for catching 
it in time!


Paolo.


Re: [v3] Regenerate Solaris 2 baselines for GCC 4.6.0 release

2011-03-15 Thread Paolo Carlini

... and I suppose the thinko alone should be fixed in 4_6-branch too, right?

Paolo.


[PATCH] Fix fallout of my fold_binary EQ/NE patch (PR middle-end/48136)

2011-03-15 Thread Jakub Jelinek
Hi!

The addition of STRIP_NOPS for EQ_EXPR/NE_EXPR revealed a bunch of cases
which rely on arg0 and arg1 having the same type.  Only the last hunk
fixes the testcase, the rest is what I saw and it was possible the
types wouldn't match.  Tried to construct testcases for the other cases,
but didn't succeed, earlier folding already modified the operands so it
didn't look like what the code was expecting.

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

2011-03-15  Jakub Jelinek  ja...@redhat.com

PR middle-end/48136
* fold-const.c (fold_binary_loc) case EQ_EXPR, NE_EXPR: Make sure
arg0/arg1 or their arguments are always fold converted to matching
types.

* gcc.c-torture/compile/pr48136.c: New test.

--- gcc/fold-const.c.jj 2011-03-15 09:47:12.0 +0100
+++ gcc/fold-const.c2011-03-15 17:13:29.0 +0100
@@ -12342,7 +12342,8 @@ fold_binary_loc (location_t loc,
{
  tem = fold_build2_loc (loc, LSHIFT_EXPR, itype, arg01, 
arg001);
  tem = fold_build2_loc (loc, BIT_AND_EXPR, itype, arg000, tem);
- return fold_build2_loc (loc, code, type, tem, arg1);
+ return fold_build2_loc (loc, code, type, tem,
+ fold_convert_loc (loc, itype, arg1));
}
  /* Otherwise, for signed (arithmetic) shifts,
 ((X  C1)  C2) != 0 is rewritten as X  0, and
@@ -12393,8 +12394,10 @@ fold_binary_loc (location_t loc,
  tree notc = fold_build1_loc (loc, BIT_NOT_EXPR,
   TREE_TYPE (TREE_OPERAND (arg0, 1)),
   TREE_OPERAND (arg0, 1));
- tree dandnotc = fold_build2_loc (loc, BIT_AND_EXPR, TREE_TYPE (arg0),
-  arg1, notc);
+ tree dandnotc
+   = fold_build2_loc (loc, BIT_AND_EXPR, TREE_TYPE (arg0),
+  fold_convert_loc (loc, TREE_TYPE (arg0), arg1),
+  notc);
  tree rslt = code == EQ_EXPR ? integer_zero_node : integer_one_node;
  if (integer_nonzerop (dandnotc))
return omit_one_operand_loc (loc, type, rslt, arg0);
@@ -12407,8 +12410,10 @@ fold_binary_loc (location_t loc,
   TREE_CODE (TREE_OPERAND (arg0, 1)) == INTEGER_CST)
{
  tree notd = fold_build1_loc (loc, BIT_NOT_EXPR, TREE_TYPE (arg1), 
arg1);
- tree candnotd = fold_build2_loc (loc, BIT_AND_EXPR, TREE_TYPE (arg0),
-  TREE_OPERAND (arg0, 1), notd);
+ tree candnotd
+   = fold_build2_loc (loc, BIT_AND_EXPR, TREE_TYPE (arg0),
+  TREE_OPERAND (arg0, 1),
+  fold_convert_loc (loc, TREE_TYPE (arg0), notd));
  tree rslt = code == EQ_EXPR ? integer_zero_node : integer_one_node;
  if (integer_nonzerop (candnotd))
return omit_one_operand_loc (loc, type, rslt, arg0);
@@ -12483,13 +12488,13 @@ fold_binary_loc (location_t loc,
   if (TREE_CODE (arg0) == BIT_XOR_EXPR
   operand_equal_p (TREE_OPERAND (arg0, 1), arg1, 0))
return fold_build2_loc (loc, code, type, TREE_OPERAND (arg0, 0),
-   build_int_cst (TREE_TYPE (arg1), 0));
+   build_int_cst (TREE_TYPE (arg0), 0));
   /* Likewise (X ^ Y) == X becomes Y == 0.  X has no side-effects.  */
   if (TREE_CODE (arg0) == BIT_XOR_EXPR
   operand_equal_p (TREE_OPERAND (arg0, 0), arg1, 0)
   reorder_operands_p (TREE_OPERAND (arg0, 1), arg1))
return fold_build2_loc (loc, code, type, TREE_OPERAND (arg0, 1),
-   build_int_cst (TREE_TYPE (arg1), 0));
+   build_int_cst (TREE_TYPE (arg0), 0));
 
   /* (X ^ C1) op C2 can be rewritten as X op (C1 ^ C2).  */
   if (TREE_CODE (arg0) == BIT_XOR_EXPR
@@ -12507,10 +12512,12 @@ fold_binary_loc (location_t loc,
   integer_pow2p (TREE_OPERAND (arg0, 1)))
{
  tem = fold_build2_loc (loc, BIT_AND_EXPR, TREE_TYPE (arg0),
-TREE_OPERAND (TREE_OPERAND (arg0, 0), 0),
-TREE_OPERAND (arg0, 1));
+TREE_OPERAND (TREE_OPERAND (arg0, 0), 0),
+TREE_OPERAND (arg0, 1));
  return fold_build2_loc (loc, code == EQ_EXPR ? NE_EXPR : EQ_EXPR,
- type, tem, arg1);
+ type, tem,
+ fold_convert_loc (loc, TREE_TYPE (arg0),
+   arg1));
}
 
   /* Fold ((X  C) ^ C) eq/ne 0 into (X  C) ne/eq 0, when the
@@ -12554,8 +12561,9 @@ fold_binary_loc (location_t loc,
   if (TREE_CODE (arg0) == NEGATE_EXPR
TREE_CODE (arg1) == NEGATE_EXPR)
return fold_build2_loc (loc, code, type,
-   

[PATCH][4.5] Fix backport of PR 47862 to 4.5 branch

2011-03-15 Thread Pat Haugen
The following changes are already present on trunk as part of the fix for 
PR44364. Not having them on 4.5 caused problems with the subject fix when trying 
to spill FP regs with a stack  32K.


Bootstrap/regtest 4.5 branch on powerpc with no new failures, ok for 4.5?

-Pat


2011-03-15  Pat Haugen pthau...@us.ibm.com

PR target/47862
* caller-save.c (insert_restore, insert_save): Use non-validate
form of adjust_address.


Index: gcc/caller-save.c
===
--- gcc/caller-save.c   (revision 170999)
+++ gcc/caller-save.c   (working copy)
@@ -1215,7 +1215,7 @@ insert_restore (struct insn_chain *chain
   /* Check that insn to restore REGNO in save_mode[regno] is
 correct.  */
reg_save_code (regno, save_mode[regno]) = 0)
-mem = adjust_address (mem, save_mode[regno], 0);
+mem = adjust_address_nv (mem, save_mode[regno], 0);
   else
 mem = copy_rtx (mem);

@@ -1296,7 +1296,7 @@ insert_save (struct insn_chain *chain, i
   /* Check that insn to save REGNO in save_mode[regno] is
 correct.  */
reg_save_code (regno, save_mode[regno]) = 0)
-mem = adjust_address (mem, save_mode[regno], 0);
+mem = adjust_address_nv (mem, save_mode[regno], 0);
   else
 mem = copy_rtx (mem);



Re: [Patch][AVR]: Support tail calls

2011-03-15 Thread Richard Henderson
On 03/11/2011 05:43 AM, Georg-Johann Lay wrote:
 I did not find a way to make this work together with -mcall-prologues.
 Please let me know if you have suggestion on how call prologues can be
 combine with tail calls.

You need a new symbol in libgcc for this.  It should be easy enough to have
the sibcall epilogue load up Z+EIND before jumping to the new symbol
(perhaps called __sibcall_restores__).  This new symbol would be just like
the existing __epilogue_restores__ except that it would finish with an
eijmp/ijmp instruction (depending on multilib) instead of a ret instruction.

 The implementation uses struct machine_function to pass information
 around, i.e. from avr_function_arg_advance to avr_function_ok_for_sibcall.

Look at how the s390 port handles this exact problem.

  /* Register 6 on s390 is available as an argument register but unfortunately
 caller saved. This makes functions needing this register for arguments
 not suitable for sibcalls.  */
  return !s390_call_saved_register_used (exp);

I'll admit that it would be helpful if the cumulative_args pointer was passed
into the ok_for_sibcall hook, but it's not *that* hard to recreate that value
by hand.  This is what the s390_call_saved_register_used function does.

 +  || (avr_OS_task_function_p (decl_callee) ^ avr_OS_task_function_p 
 (current_function_decl))

Please just use != instead of ^ here.  Also, needs line wrapping.


I do like very much how you've cleaned up the call patterns.  IMO this should
be committed as a separate patch; I'll let the AVR maintainers approve it 
though.


r~

 
 Regards, Johann
 
 
 2011-03-10  Georg-Johann Lay  a...@gjlay.de
 
   * config/avr/avr-protos.h (expand_epilogue): Change prototype
   * config/avr/avr.h (struct machine_function): Add field
   sibcall_fails.
   * config/avr/avr.c (init_cumulative_args,
   avr_function_arg_advance): Use it.
   * config/avr/avr.c (expand_epilogue): Add bool parameter. Handle
   sibcall epilogues.
   (TARGET_FUNCTION_OK_FOR_SIBCALL): Define to...
   (avr_function_ok_for_sibcall): ...this new function.
   (avr_lookup_function_attribute1): New static Function.
   (avr_naked_function_p, interrupt_function_p,
   signal_function_p, avr_OS_task_function_p,
   avr_OS_main_function_p): Use it.
   * config/avr/avr.md (sibcall, sibcall_value,
   sibcall_epilogue): New expander.
   (*call_insn, *call_value_insn): New insn.
   (call_insn, call_value_insn): Remove
   (call, call_value, epilogue): Change expander to handle
   sibling calls.



Re: [PATCH] Fix RTL DSE compile time hog (PR rtl-optimization/48141)

2011-03-15 Thread Kenneth Zadeck

so how much time does this save?

I agree that this is a useful simplification, but it seems unlikely to 
be that important in real code.
it seems like the 5000 store test would in general provide a better 
safety valve.


Kenny

On 03/15/2011 07:05 PM, Jakub Jelinek wrote:

Hi!

On the attached testcase we spend  7 minutes in RTL DSE, as we end up
with active_local_stores chain with up to 10 entries and we walk
it through on each store.

The following patch fixes it by throwing away from active_local_stores
list stores that don't have any positions needed, but can't be deleted
(I believe such stores aren't helpful at all in the list, we aren't going
to remove them anyway, and they can't be used by replace_read either).
Alternatively (or in addition to this) we might remember the length of the
active_local_stores list and just drop it on the floor when it becomes
too long (say over 5000 stores or something similar, perhaps a param).

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk (and
after a while for 4.6)?

2011-03-15  Jakub Jelinekja...@redhat.com

PR rtl-optimization/48141
* dse.c (record_store): If no positions are needed in an insn
that cannot be deleted, at least unchain it from active_local_stores.

* gcc.dg/pr48141.c: New test.

--- gcc/dse.c.jj2011-02-15 15:42:26.0 +0100
+++ gcc/dse.c   2011-03-15 21:25:59.0 +0100
@@ -1530,8 +1530,7 @@ record_store (rtx body, bb_info_t bb_inf

/* An insn can be deleted if every position of every one of
 its s_infos is zero.  */
-  if (any_positions_needed_p (s_info)
- || ptr-cannot_delete)
+  if (any_positions_needed_p (s_info))
del = false;

if (del)
@@ -1543,7 +1542,8 @@ record_store (rtx body, bb_info_t bb_inf
  else
active_local_stores = ptr-next_local_store;

- delete_dead_store_insn (insn_to_delete);
+ if (!insn_to_delete-cannot_delete)
+   delete_dead_store_insn (insn_to_delete);
}
else
last = ptr;
--- gcc/testsuite/gcc.dg/pr48141.c.jj   2011-03-15 21:48:46.0 +0100
+++ gcc/testsuite/gcc.dg/pr48141.c  2011-03-15 21:48:27.0 +0100
@@ -0,0 +1,17 @@
+/* PR rtl-optimization/48141 */
+/* { dg-do compile } */
+/* { dg-options -O } */
+
+#define A i = 0;
+#define B A A A A A A A A A A
+#define C B B B B B B B B B B
+#define D C C C C C C C C C C
+#define E D D D D D D D D D D
+
+int
+foo (void)
+{
+  volatile int i = 0;
+  E E E E E E E E E E E
+  return 0;
+}

Jakub


Re: [PATCH, committed] Refix 48053, do not abort in loading 0 into VSX register under 32-bit

2011-03-15 Thread Michael Meissner
This is a reduced version of the testcase that shows the bug that was fixed.
However it is odd, in that the code that triggered the bug is setting hard
register FR3 to 0 as a DImode value just before the call to __gcc_qmul to
multiply the two long double values, so it needs some more looking into.

2011-03-15  Michael Meissner  meiss...@linux.vnet.ibm.com

* gcc.target/powerpc/pr48053-3.c: New file, add test case for
split problem of 0 being loaded in a VSX register.

Index: gcc/testsuite/gcc.target/powerpc/pr48053-3.c
===
--- gcc/testsuite/gcc.target/powerpc/pr48053-3.c(revision 0)
+++ gcc/testsuite/gcc.target/powerpc/pr48053-3.c(revision 0)
@@ -0,0 +1,41 @@
+/* { dg-do compile } */
+/* { dg-skip-if  { powerpc*-*-darwin* } { * } {  } } */
+/* { dg-require-effective-target powerpc_vsx_ok } */
+/* { dg-options -O3 -mcpu=power7 } */
+
+/* Cut down example from s_scalbnl that aborted on 32-bit when the fix for
+   48053 went in to allow creating DImode 0's in VSX registers.  */
+
+typedef union
+{
+  long double value;
+  struct
+  {
+unsigned long long msw;
+unsigned long long lsw;
+  } parts64;
+  struct
+  {
+unsigned int w0, w1, w2, w3;
+  } parts32;
+} ieee854_long_double_shape_type;
+
+static const long double twolm54 = 5.55111512312578270212e-17;
+
+long double foo (long double x, int n)
+{
+  long long k, hx, lx;
+  ieee854_long_double_shape_type qw_u;
+
+  qw_u.value = x;
+  hx = qw_u.parts64.msw;
+  lx = qw_u.parts64.lsw;
+
+  k = ((hx  52)  0x7ff) + n + 54;
+
+  qw_u.parts64.msw = ((hx  0x800fULL) | (k  52));
+  qw_u.parts64.lsw = lx;
+  x = qw_u.value;
+
+  return x*twolm54;
+}


-- 
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


[c++] refactor some data structures into cp/parser.h (issue4295052)

2011-03-15 Thread Diego Novillo

This patch refactors some data structures out of cp/parser.c into
cp/parser.h and converts the main lexer buffer into a VEC.  No
functional changes, other than minor data structure tweaks:

- The token buffer is now a VEC.
- Instead of clobbering purged tokens, we have a purged_p marker
  bitfield.

Patch approved by Jason.  Tested on x86_64 with no new regressions.
Barring objections, I will commit it in another 24 hours.

2011-03-15  Diego Novillo  dnovi...@google.com

* Make-lang.in (CXX_PARSER_H): Define.
(cp/cp-lang.o): Add dependency on CXX_PARSER_H.
(cp/parser.o): Add dependency on CXX_PARSER_H and
tree-pretty-print.h.
* cp/cp-lang.c: Include parser.h.
* parser.c: Include parser.h and tree-pretty-print.h
(struct tree_check): Move to parser.h.
(struct cp_lexer): Likewise.
(struct cp_token_cache): Likewise.
(struct cp_token_ident_d): Likewise.
(CPP_KEYWORD): Likewise.
(CPP_TEMPLATE_ID): Likewise.
(CPP_NESTED_NAME_SPECIFIER): Likewise.
(N_CP_TTYPES): Likewise.
(enum cp_parser_status_kind): Likewise.
(struct cp_parser_context): Likewise.
(struct cp_default_arg_entry_d): Likewise.
(struct cp_unparsed_functions_entry_d): Likewise.
(struct cp_parser): Likewise.
(struct cp_token): Likewise.
Add field purged_p.
Convert field buffer into a VEC.
(CPP_PURGED): Remove.  Replace all users with access to
purged_p field.
(cp_lexer_alloc): Factor out of ...
(cp_lexer_new_main): ... here.
(cp_lexer_print_token): Call print_generic_expr to show
CPP_NUMBER tokens.
Re-write lexer loop to call VEC_safe_push to store tokens.
* config-lang.in (gtfiles): Add cp/parser.h.


Index: gcc/cp/Make-lang.in
===
--- gcc/cp/Make-lang.in (revision 171013)
+++ gcc/cp/Make-lang.in (working copy)
@@ -243,7 +243,7 @@ CXX_TREE_H = $(TREE_H) cp/name-lookup.h 
$(FUNCTION_H) \
$(SYSTEM_H) coretypes.h $(CONFIG_H) $(TARGET_H) $(GGC_H) \
$(srcdir)/../include/hashtab.h
-
+CXX_PARSER_H = tree.h c-family/c-pragma.h cp/parser.h
 CXX_PRETTY_PRINT_H = cp/cxx-pretty-print.h $(C_PRETTY_PRINT_H)
 
 cp/lex.o: cp/lex.c $(CXX_TREE_H) $(TM_H) $(FLAGS_H) \
@@ -251,7 +251,7 @@ cp/lex.o: cp/lex.c $(CXX_TREE_H) $(TM_H)
   c-family/c-objc.h
 cp/cp-lang.o: cp/cp-lang.c $(CXX_TREE_H) $(TM_H) debug.h langhooks.h \
   $(LANGHOOKS_DEF_H) $(C_COMMON_H) gtype-cp.h gt-cp-cp-lang.h \
-  cp/cp-objcp-common.h $(EXPR_H) $(TARGET_H)
+  cp/cp-objcp-common.h $(EXPR_H) $(TARGET_H) $(CXX_PARSER_H)
 cp/decl.o: cp/decl.c $(CXX_TREE_H) $(TM_H) $(FLAGS_H) cp/decl.h \
   output.h toplev.h $(HASHTAB_H) $(RTL_H) \
   cp/operators.def $(TM_P_H) $(TREE_INLINE_H) $(DIAGNOSTIC_H) $(C_PRAGMA_H) \
@@ -316,7 +316,7 @@ cp/mangle.o: cp/mangle.c $(CXX_TREE_H) $
   gt-cp-mangle.h $(TARGET_H) $(TM_P_H) $(CGRAPH_H)
 cp/parser.o: cp/parser.c $(CXX_TREE_H) $(TM_H) $(DIAGNOSTIC_CORE_H) \
   gt-cp-parser.h output.h $(TARGET_H) $(PLUGIN_H) intl.h \
-  c-family/c-objc.h
+  c-family/c-objc.h tree-pretty-print.h $(CXX_PARSER_H)
 cp/cp-gimplify.o: cp/cp-gimplify.c $(CXX_TREE_H) $(C_COMMON_H) \
$(TM_H) coretypes.h pointer-set.h tree-iterator.h
 
Index: gcc/cp/cp-lang.c
===
--- gcc/cp/cp-lang.c(revision 171013)
+++ gcc/cp/cp-lang.c(working copy)
@@ -32,6 +32,7 @@ along with GCC; see the file COPYING3.  
 #include cp-objcp-common.h
 #include hashtab.h
 #include target.h
+#include parser.h
 
 enum c_language_kind c_language = clk_cxx;
 static void cp_init_ts (void);
Index: gcc/cp/parser.c
===
--- gcc/cp/parser.c (revision 171013)
+++ gcc/cp/parser.c (working copy)
@@ -37,6 +37,8 @@ along with GCC; see the file COPYING3.  
 #include c-family/c-common.h
 #include c-family/c-objc.h
 #include plugin.h
+#include tree-pretty-print.h
+#include parser.h
 
 
 /* The lexer.  */
@@ -44,110 +46,11 @@ along with GCC; see the file COPYING3.  
 /* The cp_lexer_* routines mediate between the lexer proper (in libcpp
and c-lex.c) and the C++ parser.  */
 
-/* A token's value and its associated deferred access checks and
-   qualifying scope.  */
-
-struct GTY(()) tree_check {
-  /* The value associated with the token.  */
-  tree value;
-  /* The checks that have been associated with value.  */
-  VEC (deferred_access_check, gc)* checks;
-  /* The token's qualifying scope (used when it is a
- CPP_NESTED_NAME_SPECIFIER).  */
-  tree qualifying_scope;
-};
-
-/* A C++ token.  */
-
-typedef struct GTY (()) cp_token {
-  /* The kind of token.  */
-  ENUM_BITFIELD (cpp_ttype) type : 8;
-  /* If this token is a keyword, this value indicates which keyword.
- Otherwise, this value is RID_MAX.  */
-  ENUM_BITFIELD (rid) keyword : 8;
-  /* Token flags.  

Re: [PATCH] Add check before potentially dividing by 0

2011-03-15 Thread asharif
I have seen an ICE in 4.4.3 when a corrupted profile file causes a
division by 0 in gcc. This is the equivalent code in trunk and this
check should help fix it.
Thoughts?

2011-03-15  Ahmad Sharif  asha...@google.com

       * predict.c (probably_never_executed_bb_p): Add check to see
       whether profile_info-runs is equal to 0 before doing the division.
Index: predict.c
===
--- predict.c (revision 171019)
+++ predict.c (working copy)
@@ -200,7 +200,7 @@
 bool
 probably_never_executed_bb_p (const_basic_block bb)
 {
-  if (profile_info  flag_branch_probabilities)
+  if (profile_info  flag_branch_probabilities  profile_info-runs != 0)
     return ((bb-count + profile_info-runs / 2) / profile_info-runs) == 0;
   if ((!profile_info || !flag_branch_probabilities)
        cgraph_node (current_function_decl)-frequency ==
NODE_FREQUENCY_UNLIKELY_EXECUTED)


Re: [PATCH] Updated DW_OP_GNU_entry_value/DW_TAG_GNU_call_site patch

2011-03-15 Thread Richard Henderson
On 03/15/2011 04:19 AM, Jakub Jelinek wrote:
 Hi!
 
 Now that we are back in stage 1, I'd like move on with the
 entry_value/call_site debug info extensions.
 
 Here is the http://gcc.gnu.org/ml/gcc-patches/2010-12/msg01793.html
 patch updated to current trunk, bootstrapped/regtested on x86_64-linux
 and i686-linux.  Ok for trunk?

Ok.


r~


Re: [PATCH] Updated ENTRY_VALUE patch (PR debug/45882)

2011-03-15 Thread Richard Henderson
On 03/15/2011 04:20 AM, Jakub Jelinek wrote:
 Here is http://gcc.gnu.org/ml/gcc-patches/2010-12/msg01794.html
 patch updated to current trunk, bootstrapped/regtested on x86_64-linux and
 i686-linux, ok for trunk?

Ok.


r~


Re: [PATCH] Remove -fenable-icf-debug support

2011-03-15 Thread Richard Henderson
On 03/15/2011 04:25 AM, Jakub Jelinek wrote:
 As Cary said there are no consumers of the .debug_dcall/.debug_vcall
 sections yet and DW_TAG_GNU_call_site info should contain a superset
 of that information, this patch removes -fenable-icf-debug support,
 if you think it is desirable to remove it.
 Bootstrapped/regtested on x86_64-linux and i686-linux.

Ok.


r~


[x32] PATCH: Also check x32 for vect_cmdline_needed target.

2011-03-15 Thread H.J. Lu
x32 is similar to x86-64.  I checked this patch into x32 branch.


H.J.
---
diff --git a/gcc/testsuite/ChangeLog.x32 b/gcc/testsuite/ChangeLog.x32
index 32c3e34..9bcf223 100644
--- a/gcc/testsuite/ChangeLog.x32
+++ b/gcc/testsuite/ChangeLog.x32
@@ -1,5 +1,10 @@
 2011-03-15  H.J. Lu  hongjiu...@intel.com
 
+   * lib/target-supports.exp (check_effective_target_vect_cmdline_needed): 
+   Also check x32.
+
+2011-03-15  H.J. Lu  hongjiu...@intel.com
+
* gcc.dg/20050503-1.c: Check ia32 instead of ilp32.
* gcc.dg/builtin-apply4.c: Likewise.
* gcc.dg/pr35045.c: Likewise.
diff --git a/gcc/testsuite/lib/target-supports.exp 
b/gcc/testsuite/lib/target-supports.exp
index f46c734..01f7a65 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -1715,7 +1715,8 @@ proc check_effective_target_vect_cmdline_needed { } {
if { [istarget alpha*-*-*]
 || [istarget ia64-*-*]
 || (([istarget x86_64-*-*] || [istarget i?86-*-*])
- [check_effective_target_lp64])
+ ([check_effective_target_x32]
+|| [check_effective_target_lp64]))
 || ([istarget powerpc*-*-*]
  ([check_effective_target_powerpc_spe]
 || [check_effective_target_powerpc_altivec]))


Re: [libgfortran, build] Remove AC_TRY_* macros from libgfortran configury

2011-03-15 Thread Ralf Wildenhues
* FX wrote on Tue, Mar 15, 2011 at 10:33:01AM CET:
 The attached patch replaces the deprecated AC_TRY_{COMPILE,LINK,RUN}
 macros in libgfortran configury with their AC_*_IFELSE equivalents.
 Now (4.7 just branched) seems a good time, and I think I didn't screw
 it too much because the regenerated configure file only has whitespace
 changes. Still, I'd like to have the opinion of a build maintainer or
 autoconf guru.
 
 Bootstrapped and regtested on x86_64-darwin.
 
 OK to commit to trunk?

Yes, thanks.

Out of curiosity, did you update these manually, or did you run
autoupdate on the files?

Thanks,
Ralf