Re: [PATCH, SMS] Prevent the creation of reg-moves for definitions with MODE_CC

2012-01-01 Thread Ayal Zaks
>The attached patch prevents the creation of reg-moves for definitions
>with MODE_CC and thus solves this ICE.
>
>Currently testing and bootstrap on ppc64-redhat-linux, enabling SMS on
>loops with SC 1.
>
>OK for 4.7 once testing completes?

Yes, thanks for catching this. Shouldn't we prevent creating such
regmoves for (the other case of) intra-loop anti-deps as well?


>> While true, I doubt either PPC or MIPS really benefit from moving
>> around registers of CCmode.

IIRC, PPC has eight 4-bit CR's and supports efficient copying of *one
bit* from one CR to another (via cror), which would require special
regmove handling. Hence I share your doubt.

Ayal.


On Thu, Dec 22, 2011 at 10:53 AM, Richard Sandiford
 wrote:
> Richard Henderson  writes:
>> On 12/20/2011 09:47 AM, Richard Sandiford wrote:
>>> Revital Eres  writes:
 +/* Return true if one of the definitions in INSN has MODE_CC.  Otherwise
 +   return false.  */
 +static bool
 +def_has_ccmode_p (rtx insn)
 +{
 +  df_ref *def;
 +
 +  for (def = DF_INSN_DEFS (insn); *def; def++)
 +    {
 +      enum machine_mode mode = GET_MODE (DF_REF_REG (*def));
 +
 +      if (GET_MODE_CLASS (mode) == MODE_CC)
 +       return true;
 +    }
 +
 +  return false;
 +}
>>>
>>> FWIW, an alternative might be to test have_regs_of_mode[(int) mode].
>>> That says whether there are any allocatable (non-fixed) registers
>>> of the given mode.
>>
>> While true, I doubt either PPC or MIPS really benefit from moving
>> around registers of CCmode.  Certainly MIPS has no way of easily
>> moving CCmode registers around.  It's a rather complicated reload,
>> that.
>>
>> I'd be very tempted to simply go with the original patch.
>
> OK, sorry for the noise.
>
> Richard


[PATCH] OpenBSD/amd64 support and OpenBSD/i386 cleanup

2012-01-01 Thread Mark Kettenis
The diff below adds support for OpenBSD/amd64 and cleans up the
OpenBSD/i386 configury bits such that they can be shared.  The OpenBSD
ports people have maintained their own set of patches for these
targets, but this is a re-implementation from scratch to prevent
copyright issues.  I have a copyright assignment in place for GCC.

Thanks,

Mark


libgcc/:

2011-12-27  Mark Kettenis  

* config.host (x86_64-*-openbsd*): New target.

gcc/:

2011-12-27  Mark Kettenis  

* config.gcc (x86_64-*-openbsd*): New target.
* config/openbsd.h (TARGET_C99_FUNCTIONS): Define.
* config/i386/openbsdelf.h: Remove some superfluous defines and
group things together in a more logical fashion.
(DBX_REGISTER_NUMBER): Provide a
definition that works on both 32-bit and 64-bit targets.
(WCHAR_TYPE_SIZE): Hardcode as 32.
(NO_DOLLAR_IN_LABEL): Remove undef.
(TARGET_DEFAULT): Remove.
(SET_ASM_OP): Remove.
(DEFAULT_PCC_STRUCT_RETURN): Undef first to prevent warning.
(ASM_OUTPUT_MAX_SKIP_ALIGN): Synch with x86-64.h
(DWARF2_UNWIND_INFO): Remove define.
(HAVE_ENABLE_EXECUTE_STACK): Define.
* config/host-openbsd.c: New file.
* config/t-openbsd (USER_H): Add EXTRA_HEADERS.
* config/x-openbsd: New file.


Index: libgcc/config.host
===
--- libgcc/config.host  (revision 182693)
+++ libgcc/config.host  (working copy)
@@ -532,6 +532,8 @@
;;
 i[34567]86-*-openbsd*)
;;
+x86_64-*-openbsd*)
+   ;;
 i[34567]86-*-linux*)
extra_parts="$extra_parts crtprec32.o crtprec64.o crtprec80.o 
crtfastmath.o"
tmake_file="${tmake_file} i386/t-crtpc i386/t-crtfm i386/t-crtstuff 
t-dfprules"
Index: gcc/config.gcc
===
--- gcc/config.gcc  (revision 182693)
+++ gcc/config.gcc  (working copy)
@@ -1201,6 +1201,13 @@
gas=yes
gnu_ld=yes
;;
+x86_64-*-openbsd*)
+   tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h"
+   tm_file="${tm_file} openbsd.h openbsd-stdint.h openbsd-libpthread.h 
i386/x86-64.h i386/openbsdelf.h"
+   extra_options="${extra_options} openbsd.opt"
+   gas=yes
+   gnu_ld=yes
+   ;;
 i[34567]86-*-linux* | i[34567]86-*-kfreebsd*-gnu | i[34567]86-*-knetbsd*-gnu | 
i[34567]86-*-gnu* | i[34567]86-*-kopensolaris*-gnu)
# Intel 80386's running GNU/*
# with ELF format using glibc 2
Index: gcc/config.host
===
--- gcc/config.host (revision 182693)
+++ gcc/config.host (working copy)
@@ -296,6 +296,10 @@
 out_host_hook_obj=host-linux.o
 host_xmake_file="${host_xmake_file} x-linux"
 ;;
+  *-*-openbsd*)
+out_host_hook_obj=host-openbsd.o
+host_xmake_file="${host_xmake_file} x-openbsd"
+;;
   ia64-*-hpux*)
 use_long_long_for_widest_fast_int=yes
 out_host_hook_obj=host-hpux.o
Index: gcc/config/host-openbsd.c
===
--- gcc/config/host-openbsd.c   (revision 0)
+++ gcc/config/host-openbsd.c   (revision 0)
@@ -0,0 +1,83 @@
+/* OpenBSD host-specific hook definitions.
+   Copyright (C) 2004, 2007, 2008, 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
+   option) any later version.
+
+   GCC 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 GCC; see the file COPYING3.  If not see
+   .  */
+
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "hosthooks.h"
+#include "hosthooks-def.h"
+
+
+#undef HOST_HOOKS_GT_PCH_GET_ADDRESS
+#define HOST_HOOKS_GT_PCH_GET_ADDRESS openbsd_gt_pch_get_address
+#undef HOST_HOOKS_GT_PCH_USE_ADDRESS
+#define HOST_HOOKS_GT_PCH_USE_ADDRESS openbsd_gt_pch_use_address
+
+/* For various ports, try to guess a fixed spot in the vm space
+   that's probably free.  */
+#if defined(__amd64__)
+# define TRY_EMPTY_VM_SPACE0x4000
+#elif defined(__i386__)
+# define TRY_EMPTY_VM_SPACE0xb000
+#else
+# define TRY_EMPTY_VM_SPACE0
+#endif
+
+/* Determine a location where we might be able to reliably allocate
+   SIZE bytes.  FD is the PCH file, though we should return with the
+   file unmapped.  */
+
+static void *
+openbsd_gt_pch_get_address (size_t size, int fd)
+{
+  void *addr;
+
+  addr = mmap ((void *) TRY_EMPTY_VM_SPACE, 

[C++ testcase, committed] PR 51723

2012-01-01 Thread Paolo Carlini

Hi,

I'm adding the testcase and closing the issue.

Thanks,
Paolo.

//
2012-01-01  Paolo Carlini  

PR c++/51723
* g++.dg/cpp0x/constexpr-delegating2.C: New.
Index: g++.dg/cpp0x/constexpr-delegating2.C
===
--- g++.dg/cpp0x/constexpr-delegating2.C(revision 0)
+++ g++.dg/cpp0x/constexpr-delegating2.C(revision 0)
@@ -0,0 +1,25 @@
+// PR c++/51723
+// { dg-options -std=c++0x }
+
+template 
+struct A
+{
+  static constexpr int a[sizeof...(V)] = { V... };
+};
+
+template  constexpr int A::a[];
+
+struct B
+{
+  const int* const b;
+
+  template 
+  constexpr B(const int(&b)[N])
+  : b(b)
+  { }
+
+  template 
+  constexpr B(A)
+  : B(A::a)
+  { }
+};


Re: [PATCH, SMS] Prevent the creation of reg-moves for definitions with MODE_CC

2012-01-01 Thread Revital Eres
Hello,

> Yes, thanks for catching this. Shouldn't we prevent creating such
> regmoves for (the other case of) intra-loop anti-deps as well?

Right! sorry for missing that. I added an additional check in
create_ddg_dep_from_intra_loop_link.

Also, thanks to Bernhard Rosenkraenzer for opening PR 879725 for that
ICE in Linaro GCC DB.

Currently re-testing the patch on ppc64-redhat-linux and will commit
it once testing completes if that's OK .

Thanks,
Revital

gcc/
* ddg.c (def_has_ccmode_p): New function.
(add_cross_iteration_register_deps,
create_ddg_dep_from_intra_loop_link): Call it.

testsuite/
* gcc.dg/sms-11.c: New file.
Index: ddg.c
===
--- ddg.c   (revision 182479)
+++ ddg.c   (working copy)
@@ -166,6 +166,24 @@ autoinc_var_is_used_p (rtx def_insn, rtx
   return false;
 }
 
+/* Return true if one of the definitions in INSN has MODE_CC.  Otherwise
+   return false.  */
+static bool
+def_has_ccmode_p (rtx insn)
+{
+  df_ref *def;
+
+  for (def = DF_INSN_DEFS (insn); *def; def++)
+{
+  enum machine_mode mode = GET_MODE (DF_REF_REG (*def));
+
+  if (GET_MODE_CLASS (mode) == MODE_CC)
+   return true;
+}
+
+  return false;
+}
+
 /* Computes the dependence parameters (latency, distance etc.), creates
a ddg_edge and adds it to the given DDG.  */
 static void
@@ -202,6 +220,7 @@ create_ddg_dep_from_intra_loop_link (ddg
  whose register has multiple defs in the loop.  */
   if (flag_modulo_sched_allow_regmoves 
   && (t == ANTI_DEP && dt == REG_DEP)
+  && !def_has_ccmode_p (dest_node->insn)
   && !autoinc_var_is_used_p (dest_node->insn, src_node->insn))
 {
   rtx set;
@@ -335,7 +354,8 @@ add_cross_iteration_register_deps (ddg_p
   if (DF_REF_ID (last_def) != DF_REF_ID (first_def)
   || !flag_modulo_sched_allow_regmoves
  || JUMP_P (use_node->insn)
-  || autoinc_var_is_used_p (DF_REF_INSN (last_def), use_insn))
+  || autoinc_var_is_used_p (DF_REF_INSN (last_def), use_insn)
+ || def_has_ccmode_p (DF_REF_INSN (last_def)))
 create_ddg_dep_no_link (g, use_node, first_def_node, ANTI_DEP,
 REG_DEP, 1);
 
Index: testsuite/gcc.dg/sms-11.c
===
--- testsuite/gcc.dg/sms-11.c   (revision 0)
+++ testsuite/gcc.dg/sms-11.c   (revision 0)
@@ -0,0 +1,37 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -fmodulo-sched -fmodulo-sched-allow-regmoves 
-fdump-rtl-sms" } */
+
+extern void abort (void);
+
+float out[4][4] = { 6, 6, 7, 5, 6, 7, 5, 5, 6, 4, 4, 4, 6, 2, 3, 4 };
+
+void
+invert (void)
+{
+  int i, j, k = 0, swap;
+  float tmp[4][4] = { 5, 6, 7, 5, 6, 7, 5, 5, 4, 4, 4, 4, 3, 2, 3, 4 };
+
+  for (i = 0; i < 4; i++)
+{
+  for (j = i + 1; j < 4; j++)
+   if (tmp[j][i] > tmp[i][i])
+ swap = j;
+
+  if (swap != i)
+   tmp[i][k] = tmp[swap][k];
+}
+
+  for (i = 0; i < 4; i++)
+for (j = 0; j < 4; j++)
+  if (tmp[i][j] != out[i][j])
+   abort ();
+}
+
+int
+main ()
+{
+  invert ();
+  return 0;
+}
+
+/* { dg-final { cleanup-rtl-dump "sms" } } */


[patch] Fix PR tree-optimization/51704

2012-01-01 Thread Ira Rosen

Hi,

This patch adds a check that a statement is inside the loop/basic block
that is being analyzed before accessing its vect info.

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

Ira

ChangeLog:

PR tree-optimization/51704
* tree-vect-slp.c (vect_detect_hybrid_slp_stmts): Check that
a use is inside the basic block or loop before accessing its
vect info.

testsuite/ChangeLog:

PR tree-optimization/51704
* gfortran.dg/vect/no-fre-no-copy-prop-O3-pr51704.f90: New.
* gfortran.dg/vect/vect.exp: Run no-fre-no-copy-prop-O3-* with
corresponding flags.

(See attached file: patch.txt)Index: ChangeLog
===
--- ChangeLog   (revision 182767)
+++ ChangeLog   (working copy)
@@ -1,3 +1,10 @@
+2012-01-01  Ira Rosen  
+
+   PR tree-optimization/51704
+   * tree-vect-slp.c (vect_detect_hybrid_slp_stmts): Check that
+   a use is inside the basic block or loop before accessing its
+   vect info.
+
 2012-01-01  Jan Hubicka  
 
PR rtl-optimization/51069
Index: testsuite/gfortran.dg/vect/no-fre-no-copy-prop-O3-pr51704.f90
===
--- testsuite/gfortran.dg/vect/no-fre-no-copy-prop-O3-pr51704.f90   
(revision 0)
+++ testsuite/gfortran.dg/vect/no-fre-no-copy-prop-O3-pr51704.f90   
(revision 0)
@@ -0,0 +1,57 @@
+! { dg-do compile }
+
+  integer, parameter :: q = 2
+  integer, parameter :: nx=3, ny=2*q, nz=5
+  integer, parameter, dimension(nx,ny,nz) :: p  = &
+& reshape ((/ (i**2, i=1,size(p)) /), shape(p))
+  integer, parameter, dimension(   ny,nz) :: px = &
+& reshape ((/ (( &
+&   +  nx*(nx-1)*(2*nx-1)/6, &
+&   j=0,ny-1), k=0,nz-1) /), shape(px))
+  integer, parameter, dimension(nx,   nz) :: py = &
+& reshape ((/ (( &
+&   +(nx   )**2*ny*(ny-1)*(2*ny-1)/6, &
+&   i=0,nx-1), k=0,nz-1) /), shape(py))
+  integer, parameter, dimension(nx,ny   ) :: pz = &
+& reshape ((/ (( &
+&   +(nx*ny)**2*nz*(nz-1)*(2*nz-1)/6, &
+&   i=0,nx-1), j=0,ny-1) /), shape(pz))
+  integer, dimension(nx,ny,nz) :: a
+  integer, dimension(nx,ny   ) :: az
+  if (sum(sum(sum(a,1),2),1) /= sum(a)) call abort
+  if (sum(sum(sum(a,3),1),1) /= sum(a)) call abort
+  if (any(1+sum(eid(a),1)+ax+sum( &
+neid3(a), &
+1)+1  /= 3*ax+2))call abort
+  if (any(1+eid(sum(a,2))+ay+ &
+neid2( &
+sum(a,2) &
+)+1  /= 3*ay+2))call abort
+  if (any(sum(eid(sum(a,3))+az+2* &
+neid2(az) &
+,1)+1 /= 4*sum(az,1)+1)) call abort
+contains
+  elemental function eid (x)
+integer, intent(in) :: x
+  end function eid
+  function neid2 (x)
+integer, intent(in) :: x(:,:)
+integer :: neid2(size(x,1),size(x,2))
+neid2 = x
+  end function neid2
+  function neid3 (x)
+integer, intent(in) :: x(:,:,:)
+integer :: neid3(size(x,1),size(x,2),size(x,3))
+  end function neid3
+  elemental subroutine set (o, i)
+integer, intent(in)  :: i
+integer, intent(out) :: o
+  end subroutine set
+  elemental subroutine tes (i, o)
+integer, intent(in)  :: i
+integer, intent(out) :: o
+  end subroutine tes
+end
+
+! { dg-final { cleanup-tree-dump "vect" } }
+
Index: testsuite/gfortran.dg/vect/vect.exp
===
--- testsuite/gfortran.dg/vect/vect.exp (revision 182767)
+++ testsuite/gfortran.dg/vect/vect.exp (working copy)
@@ -90,6 +90,12 @@ lappend DEFAULT_VECTCFLAGS "-Ofast"
 dg-runtest [lsort [glob -nocomplain 
$srcdir/$subdir/Ofast-*.\[fF\]{,90,95,03,08} ]]  \
 "" $DEFAULT_VECTCFLAGS
 
+# With -fno-tree-copy-prop -fno-tree-fre -O3
+set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
+lappend DEFAULT_VECTCFLAGS "-fno-tree-copy-prop" "-fno-tree-fre" "-O3"
+dg-runtest [lsort [glob -nocomplain 
$srcdir/$subdir/no-fre-no-copy-prop-O3-*.\[fF\]{,90,95,03,08} ]]  \
+"" $DEFAULT_VECTCFLAGS
+
 # Clean up.
 set dg-do-what-default ${save-dg-do-what-default}
 
Index: testsuite/ChangeLog
===
--- testsuite/ChangeLog (revision 182767)
+++ testsuite/ChangeLog (working copy)
@@ -1,3 +1,10 @@
+2012-01-01  Ira Rosen  
+
+   PR tree-optimization/51704
+   * gfortran.dg/vect/no-fre-no-copy-prop-O3-pr51704.f90: New.
+   * gfortran.dg/vect/vect.exp: Run no-fre-no-copy-prop-O3-* with
+   corresponding flags.
+
 2012-01-01  Jan Hubicka  
 
PR rtl-optimization/51069
Index: tree-vect-slp.c
===
--- tree-vect-slp.c (revision 182767)
+++ tree-vect-slp.c (working copy)
@@ -1,5 +1,5 @@
 /* SLP - Basic Block Vectorization
-   Copyright (C) 2007, 2008, 2009, 2010, 2011
+   Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012
Free Software Foundation, In

[PATCH] Update copyright years

2012-01-01 Thread Jakub Jelinek
Hi!

Committed to trunk as every year...

2012-01-01  Jakub Jelinek  
gcc/
* gcc.c (process_command): Update copyright notice dates.
* gcov.c (print_version): Likewise.
* gcov-dump.c (print_version): Likewise.
* mips-tfile.c (main): Likewise.
* mips-tdump.c (main): Likewise.
gcc/fortran/
* gfortranspec.c (lang_specific_driver): Update copyright notice
dates.
gcc/java/
* jcf-dump.c (version): Update copyright notice dates.
libmudflap/
* mf-runtime.c (__mf_usage): Update copyright notice dates.
libjava/
* gnu/gcj/convert/Convert.java (version): Update copyright notice
dates.
* gnu/gcj/tools/gcj_dbtool/Main.java (main): Likewise.
libjava/classpath/
* gnu/java/rmi/registry/RegistryImpl.java (version): Update
copyright notice dates.
* tools/gnu/classpath/tools/orbd/Main.java (run): Likewise.

--- gcc/java/jcf-dump.c (revision 182772)
+++ gcc/java/jcf-dump.c (working copy)
@@ -2,7 +2,7 @@
Functionally similar to Sun's javap.
 
Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
-   2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+   2006, 2007, 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
 
 This file is part of GCC.
 
@@ -1162,7 +1162,7 @@ static void
 version (void)
 {
   printf ("jcf-dump %s%s\n\n", pkgversion_string, version_string);
-  printf ("Copyright %s 2011 Free Software Foundation, Inc.\n", _("(C)"));
+  printf ("Copyright %s 2012 Free Software Foundation, Inc.\n", _("(C)"));
   printf (_("This is free software; see the source for copying conditions.  
There is NO\n"
"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR 
PURPOSE.\n\n"));
   exit (0);
--- gcc/mips-tdump.c(revision 182772)
+++ gcc/mips-tdump.c(working copy)
@@ -1,6 +1,6 @@
 /* Read and manage MIPS symbol tables from object modules.
Copyright (C) 1991, 1994, 1995, 1997, 1998, 1999, 2000, 2001, 2003, 2004,
-   2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+   2006, 2007, 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
Contributed by hartz...@boulder.colorado.edu,
Rewritten by meiss...@osf.org.
 
@@ -1405,7 +1405,7 @@ main (int argc, char **argv)
   if (version)
 {
   printf ("mips-tdump %s%s\n", pkgversion_string, version_string);
-  fputs ("Copyright (C) 2011 Free Software Foundation, Inc.\n", stdout);
+  fputs ("Copyright (C) 2012 Free Software Foundation, Inc.\n", stdout);
   fputs ("This is free software; see the source for copying conditions.  
There is NO\n\
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR 
PURPOSE.\n\n",
  stdout);
--- gcc/mips-tfile.c(revision 182772)
+++ gcc/mips-tfile.c(working copy)
@@ -3,7 +3,7 @@
in the form of comments (the mips assembler does not support
assembly access to debug information).
Copyright (C) 1991, 1993, 1994, 1995, 1997, 1998, 1999, 2000, 2001,
-   2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
+   2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
Free Software Foundation, Inc.
Contributed by Michael Meissner (meiss...@cygnus.com).
 
@@ -4715,7 +4715,7 @@ main (int argc, char **argv)
   if (version)
 {
   printf (_("mips-tfile %s%s\n"), pkgversion_string, version_string);
-  fputs ("Copyright (C) 2011 Free Software Foundation, Inc.\n", stdout);
+  fputs ("Copyright (C) 2012 Free Software Foundation, Inc.\n", stdout);
   fputs (_("This is free software; see the source for copying conditions.  
There is NO\n\
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR 
PURPOSE.\n\n"),
 stdout);
--- gcc/gcc.c   (revision 182772)
+++ gcc/gcc.c   (working copy)
@@ -1,7 +1,7 @@
 /* Compiler driver program that can handle many languages.
Copyright (C) 1987, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
-   2010, 2011
+   2010, 2011, 2012
Free Software Foundation, Inc.
 
 This file is part of GCC.
@@ -6557,7 +6557,7 @@ main (int argc, char **argv)
 {
   printf (_("%s %s%s\n"), progname, pkgversion_string,
  version_string);
-  printf ("Copyright %s 2011 Free Software Foundation, Inc.\n",
+  printf ("Copyright %s 2012 Free Software Foundation, Inc.\n",
  _("(C)"));
   fputs (_("This is free software; see the source for copying conditions.  
There is NO\n\
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR 
PURPOSE.\n\n"),
--- gcc/gcov.c  (revision 182772)
+++ gcc/gcov.c  (working copy)
@@ -1,7 +1,7 @@
 /* Gcov.c: prepend line execution counts and branch probabilities to a
source file.
Copyright (C) 1990, 1991, 1992, 1993, 1994, 1996, 1997, 1998, 1999,
-   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
+   2000, 2001, 2002, 2003, 200

Re: [PATCH SMS 2/2, RFC] Register pressure estimation for the partial schedule (re-submission)

2012-01-01 Thread Revital Eres
Hello,

Thanks for the comments! I incorporated them in the attached patch.

Currently testing and bootstrap with the other patch in the series on
ppc64-redhat-linux, enabling SMS on loops with SC 1.

Thanks again,
Revital

2012-01-01  Richard Sandiford  
Revital Eres  

* loop-invariant.c (get_regno_pressure_class): Move function to...
* ira.c: Here.
* common.opt (fmodulo-sched-reg-pressure, -fmodulo-sched-verbose):
New flags.
* doc/invoke.texi (fmodulo-sched-reg-pressure,
-fmodulo-sched-verbose): Document the flags.
* ira.h (get_regno_pressure_class,
reset_pseudo_classes_defined_p): Declare.
* ira-costs.c (reset_pseudo_classes_defined_p): New function.
* Makefile.in (modulo-sched.o): Include ira.h and modulo-sched.h.
(modulo-sched-pressure.o): New.
* modulo-sched.c (ira.h, modulo-sched.h): New includes.
(partial_schedule_ptr, ps_insn_ptr, struct ps_insn,
struct ps_reg_move_info, struct partial_schedule): Move to
modulo-sched.h.
(ps_rtl_insn, ps_reg_move): Remove static.
(apply_reg_moves): Remove static and call df_insn_rescan only
if PS is final.
(undo_reg_moves): New function.
(sms_schedule): Call register pressure estimation.
* modulo-sched.h: New file.
* modulo-sched-pressure.c: New file.
Index: doc/invoke.texi
===
--- doc/invoke.texi (revision 182766)
+++ doc/invoke.texi (working copy)
@@ -374,6 +374,7 @@ Objective-C and Objective-C++ Dialects}.
 -floop-parallelize-all -flto -flto-compression-level @gol
 -flto-partition=@var{alg} -flto-report -fmerge-all-constants @gol
 -fmerge-constants -fmodulo-sched -fmodulo-sched-allow-regmoves @gol
+-fmodulo-sched-reg-pressure -fmodulo-sched-verbose=@var{n} @gol
 -fmove-loop-invariants fmudflap -fmudflapir -fmudflapth -fno-branch-count-reg 
@gol
 -fno-default-inline @gol
 -fno-defer-pop -fno-function-cse -fno-guess-branch-probability @gol
@@ -6476,6 +6477,16 @@ deleted which will trigger the generatio
 life-range analysis.  This option is effective only with
 @option{-fmodulo-sched} enabled.
 
+@item -fmodulo-sched-reg-pressure
+@opindex fmodulo-sched-reg-pressure
+Do not apply @option{-fmodulo-sched} to loops if the result would lead
+to register spilling within the loop.
+This option is effective only with @option{-fmodulo-sched} enabled.
+
+@item -fmodulo-sched-verbose=@var{n}
+@opindex fmodulo-sched-verbose
+Set up how verbose dump file for the SMS will be.  
+
 @item -fno-branch-count-reg
 @opindex fno-branch-count-reg
 Do not use ``decrement and branch'' instructions on a count register,
Index: modulo-sched.h
===
--- modulo-sched.h  (revision 0)
+++ modulo-sched.h  (revision 0)
@@ -0,0 +1,120 @@
+/* Swing Modulo Scheduling implementation.
+   Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 
+   Free Software Foundation, Inc.
+   Contributed by Revital Eres  
+
+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 option) any later
+version.
+
+GCC 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 GCC; see the file COPYING3.  If not see
+.  */
+
+#ifndef GCC_SMS_H
+#define GCC_SMS_H
+
+#include "ddg.h"
+
+extern HARD_REG_SET eliminable_regset;
+
+typedef struct partial_schedule *partial_schedule_ptr;
+
+typedef struct ps_insn *ps_insn_ptr;
+
+/* A single instruction in the partial schedule.  */
+struct ps_insn
+{
+  /* Identifies the instruction to be scheduled.  Values smaller than
+ the ddg's num_nodes refer directly to ddg nodes.  A value of
+ X - num_nodes refers to register move X.  */
+  int id;
+
+  /* The (absolute) cycle in which the PS instruction is scheduled.
+ Same as SCHED_TIME (node).  */
+  int cycle;
+
+  /* The next/prev PS_INSN in the same row.  */
+  ps_insn_ptr next_in_row,
+ prev_in_row;
+
+};
+
+/* Information about a register move that has been added to a partial
+   schedule.  */
+struct ps_reg_move_info
+{
+  /* The source of the move is defined by the ps_insn with id DEF.
+ The destination is used by the ps_insns with the ids in USES.  */
+  int def;
+  sbitmap uses;
+
+  /* The original form of USES' instructions used OLD_REG, but they
+ should now use NEW_REG.  */
+  rtx old_reg;
+  rtx new_reg;
+
+  /* The number of consecutive stages that the move occupies.  */
+  int num_consecutive_stages;
+
+  /* An instruction

Re: [C++ Patch] PR 51379

2012-01-01 Thread Jason Merrill

OK.

Jason


[C++ Patch] PR 16603

2012-01-01 Thread Paolo Carlini

Hi,

in the audit trail of this *old* PR, which is about the miscompilation of:

char const c = 'q';

enum
  {
x = c,
y = sizeof(x)
  };

int test[y == sizeof(char) ? 1 : -1];

Andrew noticed that the problem is in the perform_integral_promotions 
call at the beginning of build_enumerator. Now, the "funny" thing is, I 
don't see why we should be calling it at all! Thus I applied the below 
and booted it all languages (minus Ada) on x86_64-linux multilib and 
tested C/C++ (the other languages in progress). Can you imagine a reason 
why it may not be Ok?


Thanks,
Paolo.

//
/cp
2012-01-01  Paolo Carlini  

PR c++/16603
* decl.c (build_enumerator): Don't call perform_integral_promotions
on the value.

/testsuite
2012-01-01  Paolo Carlini  

PR c++/16603
* g++.dg/parse/enum8.C: New.

Index: testsuite/g++.dg/parse/enum8.C
===
--- testsuite/g++.dg/parse/enum8.C  (revision 0)
+++ testsuite/g++.dg/parse/enum8.C  (revision 0)
@@ -0,0 +1,11 @@
+// PR c++/16603
+
+char const c = 'q';
+
+enum
+  {
+x = c,
+y = sizeof(x)
+  };
+
+int test[y == sizeof(char) ? 1 : -1];
Index: cp/decl.c
===
--- cp/decl.c   (revision 182769)
+++ cp/decl.c   (working copy)
@@ -12369,14 +12369,11 @@ build_enumerator (tree name, tree value, tree enum
{
  value = cxx_constant_value (value);
 
- if (TREE_CODE (value) == INTEGER_CST
- && INTEGRAL_OR_ENUMERATION_TYPE_P (TREE_TYPE (value)))
+ if (TREE_CODE (value) != INTEGER_CST
+ || ! INTEGRAL_OR_ENUMERATION_TYPE_P (TREE_TYPE (value)))
{
- value = perform_integral_promotions (value);
-   }
- else
-   {
- error ("enumerator value for %qD is not an integer constant", 
name);
+ error ("enumerator value for %qD is not an integer constant",
+name);
  value = NULL_TREE;
}
}


Re: [C++ Patch] PR 16603

2012-01-01 Thread Jason Merrill

On 01/01/2012 03:17 PM, Paolo Carlini wrote:

Andrew noticed that the problem is in the perform_integral_promotions
call at the beginning of build_enumerator. Now, the "funny" thing is, I
don't see why we should be calling it at all!


Indeed, 7.2 seems pretty clear that we shouldn't.  OK.

Jason



[PATCH] RFC: Interix resurrection

2012-01-01 Thread Douglas Rupp

This is for 32bit, "C" language only.
Tested by cross and then cross-native from x86_64 Linux

--Doug

2012-01-01  Douglas B Rupp  

/config/mh-interix: Remove as unneeded.
/config/picflag.m4 (i[[34567]]86-*-interix3*):
 Change triplet to i[[34567]]86-*-interix[[3-9]]*.
libgcc/config.host (i[34567]86-*-interix3*):
 Change triplet to i[34567]86-*-interix[3-9]*.
/configure.ac: Remove reference to mh-interix.
/configure: Regenerate.
/libada/configure: Regenerate.
/libgcc/configure: Regenerate.
/liberty/configure: Regenerate.

config.gcc: (i[34567]86-*-interix3*): Remove from obsolete
 configurations. Change triplet to i[34567]86-*-interix[3-9]*.
(extra_options) interix.opt -> i386/interix.opt"
(extra_objs):Add winnt-stubs.o
configure.ac: Add interix to target_os .comm on PE check.
configure: Regenerate.
config/interix3.h: Delete and move bits to..
config/interix.h: Delete and move bits to..
config/i386/i386-interix3.h: Delete and move bits to..
config/i386/i386-interix.h: ..here.
(TARGET_CPU_DEFAULT): Remove redefinition.
(TARGET_ASM_CONSTRUCTOR): Undefine.
(SUBTARGET_SWITCHES): Define for ms-bitfields.
(TARGET_OS_CPP_BUILTINS): Remove __OPENNT. Add __declspec.
(PTRDIFF_TYPE): Define.
(LONG_DOUBLE_TYPE_SIZE): Define.
(LIBGCC2_LONG_DOUBLE_TYPE_SIZE): Define.
(SUBTARGET_OVERRIDE_OPTIONS): Remove.
(TARGET_SECTION_TYPE_FLAGS): Define.
(ASM_DECLARE_FUNCTION_NAME): Define.
(ASM_OUTPUT_EXTERNAL): Define.
(ASM_OUTPUT_EXTERNAL_LIBCALL): Define.
(ASM_OUTPUT_ALIGNED_BSS): Define.
(PCC_BITFIELD_TYPE_MATTERS): Define.
(USE_CONST_SECTION): Define.
(SUBTARGET_ENCODE_SECTION_INFO): Remove.
(TARGET_ASM_FUNCTION_RODATA_SECTION): Remove.
(SUPPORTS_ONE_ONLY): Remove.
(I386_PE_STRIP_ENCODING): Define.
config/interix.opt: Delete and move bits to..
config/i386/interix.opt: ..here.
(mpe-aligned-commons): Add.
config/i386/t-interix: Add copyright header.
(winnt-stubs.o): Add rule.
testsuite/gcc.dg/builtins-config.h: (HAVE_C99_RUNTIME):
 Do not define for Interix.

--- gcc.old/config/mh-interix   2011-12-10 12:49:59.0 -0800
+++ gcc/config/mh-interix   1969-12-31 16:00:00.0 -0800
@@ -1,2 +0,0 @@
-# The shell may not be in /bin. 
-SHELL = sh
--- gcc.old/config/picflag.m4   2011-12-10 12:49:59.0 -0800
+++ gcc/config/picflag.m4   2011-12-31 18:32:37.0 -0800
@@ -19,7 +19,7 @@ case "${$2}" in
;;
 i[[34567]]86-*-cygwin* | i[[34567]]86-*-mingw* | x86_64-*-mingw*)
;;
-i[[34567]]86-*-interix3*)
+i[[34567]]86-*-interix[[3-9]]*)
# Interix 3.x gcc -fpic/-fPIC options generate broken code.
# Instead, we relocate shared libraries at runtime.
;;
--- gcc.old/libgcc/config.host  2011-12-10 12:56:00.0 -0800
+++ gcc/libgcc/config.host  2011-12-19 18:21:15.0 -0800
@@ -634,7 +634,7 @@ x86_64-*-mingw*)
tmake_file="${tmake_file} ${tmake_eh_file} ${tmake_dlldir_file} 
i386/t-slibgcc-cygming i386/t-mingw32 t-dfprules i386/t-crtfm i386/t-chkstk"
extra_parts="$extra_parts crtfastmath.o"
;;
-i[34567]86-*-interix3*)
+i[34567]86-*-interix[3-9]*)
tmake_file="$tmake_file i386/t-interix i386/t-chkstk"
;;
 ia64*-*-elf*)
--- gcc.old/configure.ac2011-12-10 13:06:46.0 -0800
+++ gcc/configure.ac2011-12-12 19:04:46.0 -0800
@@ -1077,9 +1079,6 @@ case "${host}" in
   *-mingw*)
 host_makefile_frag="config/mh-mingw"
 ;;
-  *-interix*)
-host_makefile_frag="config/mh-interix"
-;;
   hppa*-hp-hpux10*)
 host_makefile_frag="config/mh-pa-hpux10"
 ;;
--- gcc.old/gcc/config.gcc  2011-12-10 13:05:49.0 -0800
+++ gcc/gcc/config.gcc  2011-12-31 18:25:02.0 -0800
@@ -243,7 +243,6 @@ md_file=
 # Obsolete configurations.
 case ${target} in
alpha*-dec-osf5.1*  \
- | i[34567]86-*-interix3*  \
  | mips-sgi-irix6.5\
  | mips*-*-openbsd*\
  | score-* \
@@ -1472,11 +1471,11 @@ i[34567]86-*-mingw* | x86_64-*-mingw*)
;;
esac
;;
-i[34567]86-*-interix3*)
-   tm_file="${tm_file} i386/unix.h i386/bsd.h i386/gas.h 
i386/i386-interix.h i386/i386-interix3.h interix.h interix3.h"
+i[34567]86-*-interix[3-9]*)
+   tm_file="${tm_file} i386/unix.h i386/bsd.h i386/gas.h 
i386/i386-interix.h"
tmake_file="${tmake_file} i386/t-interix"
-   extra_options="${extra_options} rpath.opt interix.opt"
-   extra_objs=winnt.o
+   extra_options="${extra_options} rpath.opt i386/interix.opt"
+   extra_objs="winnt.o winnt-stubs.o"
target_gtfiles="\$(srcdir)/config/i386/win

[patch libstdc++]: Fix PR/51673

2012-01-01 Thread Kai Tietz
Hello,

additionally to the suggested patch by Pawel Sikora, I added the
adjustments for mt-allocator to it too.

ChangeLog

2012-01-01  Kai Tietz  

PR libstc++/51673
  * config/abi/pre/gnu-versioned-namespace.ver: Adjusted new/delete
  operators signature for LLP64 size_t, and adjusted signatures for
  mt-allocator using size_t.

Tested for x86_64-w64-mingw32, and regression tested also for
x86_64-unknown-linux-gnu.  Ok for apply to trunk and 4.6.x?

Kai

Index: gnu-versioned-namespace.ver
===
--- gnu-versioned-namespace.ver (revision 182720)
+++ gnu-versioned-namespace.ver (working copy)
@@ -42,9 +42,9 @@
 __once_proxy;

 # operator new(size_t)
-_Znw[jm];
+_Znw[jmy];
 # operator new(size_t, std::nothrow_t const&)
-_Znw[jm]RKSt9nothrow_t;
+_Znw[jmy]RKSt9nothrow_t;

 # operator delete(void*)
 _ZdlPv;
@@ -52,9 +52,9 @@
 _ZdlPvRKSt9nothrow_t;

 # operator new[](size_t)
-_Zna[jm];
+_Zna[jmy];
 # operator new[](size_t, std::nothrow_t const&)
-_Zna[jm]RKSt9nothrow_t;
+_Zna[jmy]RKSt9nothrow_t;

 # operator delete[](void*)
 _ZdaPv;
@@ -93,16 +93,16 @@

 # __gnu_cxx::__pool
 _ZN9__gnu_cxx3__76__poolILb[01]EE13_M_initializeEv;
-_ZN9__gnu_cxx3__76__poolILb[01]EE16_M_reserve_blockE[jm][jm];
-_ZN9__gnu_cxx3__76__poolILb[01]EE16_M_reclaim_blockEPc[jm];
+_ZN9__gnu_cxx3__76__poolILb[01]EE16_M_reserve_blockE[jmy][jmy];
+_ZN9__gnu_cxx3__76__poolILb[01]EE16_M_reclaim_blockEPc[jmy];
 _ZN9__gnu_cxx3__76__poolILb[01]EE10_M_destroyEv;
 _ZN9__gnu_cxx3__76__poolILb1EE16_M_get_thread_idEv;

-_ZN9__gnu_cxx3__717__pool_alloc_base9_M_refillE[jm];
-_ZN9__gnu_cxx3__717__pool_alloc_base16_M_get_free_listE[jm];
+_ZN9__gnu_cxx3__717__pool_alloc_base9_M_refillE[jmy];
+_ZN9__gnu_cxx3__717__pool_alloc_base16_M_get_free_listE[jmy];
 _ZN9__gnu_cxx3__717__pool_alloc_base12_M_get_mutexEv;

-_ZN9__gnu_cxx3__79free_list6_M_getE[jm];
+_ZN9__gnu_cxx3__79free_list6_M_getE[jmy];
 _ZN9__gnu_cxx3__79free_list8_M_clearEv;

 # __gnu_cxx::stdio_sync_filebuf


Re: [Patch, Fortran] PR 51682 - Fix coarray issues with -fdefault-integer-8

2012-01-01 Thread Mikael Morin
On 31/12/2011 18:03, Tobias Burnus wrote:
> OK for the trunk?
> 
OK
Thanks

Mikael


Re: [patch libstdc++]: Fix PR/51673

2012-01-01 Thread Paolo Carlini

Hi,

Hello,

additionally to the suggested patch by Pawel Sikora, I added the
adjustments for mt-allocator to it too.

ChangeLog

2012-01-01  Kai Tietz

 PR libstc++/51673
   * config/abi/pre/gnu-versioned-namespace.ver: Adjusted new/delete
   operators signature for LLP64 size_t, and adjusted signatures for
   mt-allocator using size_t.

Tested for x86_64-w64-mingw32, and regression tested also for
x86_64-unknown-linux-gnu.  Ok for apply to trunk and 4.6.x?
Benjamin, can you have a look to this? I suspect the other established 
allocators (like, eg, pool) should be also dealt with, but I don't know 
versioned namespace well enough to properly review the patch.


Thanks,
Paolo.


[RFH / Patch] PR 20140

2012-01-01 Thread Paolo Carlini

Hi,

I'm trying to do something about this old PR, which I find rather 
disturbing: I see what's going wrong - and shouldn't be too hard to fix, 
but I'd like to have help on the appropriate way to actually do it.


We have this kind of snippet:

template void foo() {
unsigned char s[] = "";
}

int main() {
/* removing either of the calls below makes the error disappear */
foo();
foo();
}

and what happens is that for the *second* instantiation of foo (the 
specific types don't matter at all) we produce a bugus error message 
(about a wide-string as initializer for s).


Thus we have some sort of corruption in the data structures, otherwise 
two different instantiations cannot possibly affect each other.


Indeed, in digest_init_r we do something like, around line 910:

TREE_TYPE (init) = type;

which cannot be right when it does something useful, because init is a 
STRING_CST here which will be used also in the other instantiations!


The analysis is confirmed by the fact that the rather heavy handed 
patchlet which I'm attaching, which uses copy_node to avoid the 
corruption, "works". How do we normally handle this kind of situation?


Thanks,
Paolo.

/


Index: typeck2.c
===
--- typeck2.c   (revision 182776)
+++ typeck2.c   (working copy)
@@ -902,7 +902,11 @@ digest_init_r (tree type, tree init, bool nested,
}
}
 
- TREE_TYPE (init) = type;
+ if (type != TREE_TYPE (init))
+   {
+ init = copy_node (init);
+ TREE_TYPE (init) = type;
+   }
  if (TYPE_DOMAIN (type) != 0 && TREE_CONSTANT (TYPE_SIZE (type)))
{
  int size = TREE_INT_CST_LOW (TYPE_SIZE (type));


Re: [RFH / Patch] PR 20140

2012-01-01 Thread Jason Merrill

On 01/01/2012 08:10 PM, Paolo Carlini wrote:

The analysis is confirmed by the fact that the rather heavy handed
patchlet which I'm attaching, which uses copy_node to avoid the
corruption, "works". How do we normally handle this kind of situation?


In most cases, trees are unshared at instantiation time, but that 
doesn't apply to constants like this.  The patch is OK.


Jason



[SH] PR 31640 - cache block alignment is too aggressive on sh-elf

2012-01-01 Thread Oleg Endo
The attached patch addresses PR 31640.
It reduces the the default function alignment when not optimizing for
size from cache line size (32 bytes) to 4 bytes and sets the loop
alignment to 4 bytes when not optimizing for size.  Moreover, it brings
back the -falign-loops option which was always overridden and disabled
for -m4.

Tested against rev 182734 with 
make -k -check RUNTESTFLAGS="--target_board=sh-sim
\{-m2/-ml,
-m2/-mb,
-m2a-single/-mb,
-m4-single/-ml,
-m4-single/-mb,
-m4a-single/-ml,
-m4a-single/-mb}"

and no new failures. 
OK for trunk?

2012-01-02  Oleg Endo  

PR target/31640
* config/sh/sh.h (LOOP_ALIGN): Move logic to ...
* config/sh/sh.c (sh_loop_align): ... here.  Don't disable loop
alignment for TARGET_HARD_SH4.
(sh_option_override): Reduce default function alignment.  Set 
loop alignment to 4 bytes when not optimizing for size.
Index: gcc/config/sh/sh.c
===
--- gcc/config/sh/sh.c	(revision 182734)
+++ gcc/config/sh/sh.c	(working copy)
@@ -816,20 +816,42 @@
 	}
 }
 
+  /*  Adjust loop, jump and function alignment values (in bytes), if those
+  were not specified by the user using -falign-loops, -falign-jumps
+  and -falign-functions options.
+  32 bit alignment is better for speed, because instructions can be
+  fetched as a pair from a longword boundary.  For size use 16 bit
+  alignment to get more compact code.
+  Aligning all jumps increases the code size, even if it might
+  result in slightly faster code.  Thus, it is set to the smallest 
+  alignment possible if not specified by the user.  */
   if (align_loops == 0)
-align_loops =  1 << (TARGET_SH5 ? 3 : 2);
+{
+  if (TARGET_SH5)
+	align_loops = 8;
+  else
+	align_loops = optimize_size ? 2 : 4;
+}
+
   if (align_jumps == 0)
-align_jumps = 1 << CACHE_LOG;
+{
+  if (TARGET_SHMEDIA)
+	align_jumps = 1 << CACHE_LOG;
+  else
+	align_jumps = 2;
+}
   else if (align_jumps < (TARGET_SHMEDIA ? 4 : 2))
 align_jumps = TARGET_SHMEDIA ? 4 : 2;
 
-  /* Allocation boundary (in *bytes*) for the code of a function.
- SH1: 32 bit alignment is faster, because instructions are always
- fetched as a pair from a longword boundary.
- SH2 .. SH5 : align to cache line start.  */
   if (align_functions == 0)
-align_functions
-  = optimize_size ? FUNCTION_BOUNDARY/8 : (1 << CACHE_LOG);
+{
+  if (TARGET_SHMEDIA)
+	align_functions = optimize_size
+			  ? FUNCTION_BOUNDARY/8 : (1 << CACHE_LOG);
+  else
+	align_functions = optimize_size ? 2 : 4;
+}
+
   /* The linker relaxation code breaks when a function contains
  alignments that are larger than that at the start of a
  compilation unit.  */
@@ -5342,6 +5364,9 @@
 {
   rtx next = label;
 
+  if (! optimize || optimize_size)
+return 0;
+
   do
 next = next_nonnote_insn (next);
   while (next && LABEL_P (next));
Index: gcc/config/sh/sh.h
===
--- gcc/config/sh/sh.h	(revision 182734)
+++ gcc/config/sh/sh.h	(working copy)
@@ -579,9 +579,7 @@
 #define LABEL_ALIGN_AFTER_BARRIER(LABEL_AFTER_BARRIER) \
   barrier_align (LABEL_AFTER_BARRIER)
 
-#define LOOP_ALIGN(A_LABEL) \
-  ((! optimize || TARGET_HARD_SH4 || optimize_size) \
-   ? 0 : sh_loop_align (A_LABEL))
+#define LOOP_ALIGN(A_LABEL) sh_loop_align (A_LABEL)
 
 #define LABEL_ALIGN(A_LABEL) \
 (	\


Re: [RFH / Patch] PR 20140

2012-01-01 Thread Paolo Carlini

On 01/02/2012 02:49 AM, Jason Merrill wrote:

On 01/01/2012 08:10 PM, Paolo Carlini wrote:

The analysis is confirmed by the fact that the rather heavy handed
patchlet which I'm attaching, which uses copy_node to avoid the
corruption, "works". How do we normally handle this kind of situation?
In most cases, trees are unshared at instantiation time, but that 
doesn't apply to constants like this.  The patch is OK.
Oh I see, thanks. Then I'm going to properly test it, etc, and if 
everything goes well, I'll post what I will actually commit.


Thanks again,
Paolo.


Re: Keep static VTA locs in cselib tables only

2012-01-01 Thread Hans-Peter Nilsson
> From: Alexandre Oliva 
> Date: Sat, 31 Dec 2011 20:57:24 +0100

> * cselib.h (cselib_add_permanent_equiv): Declare.
> (canonical_cselib_val): New.
> * cselib.c (new_elt_loc_list): Rework to support value
> equivalences.  Adjust all callers.
> (preserve_only_constants): Retain value equivalences.
> (references_value_p): Retain preserved values.
> (rtx_equal_for_cselib_1): Handle value equivalences.
> (cselib_invalidate_regno): Use canonical value.
> (cselib_add_permanent_equiv): New.
> * alias.c (find_base_term): Reset locs lists while recursing.
> * var-tracking.c (val_bind): New.  Don't add equivalences
> present in cselib table, compared with code moved from...
> (val_store): ... here.
> (val_resolve): Use val_bind.
> (VAL_EXPR_HAS_REVERSE): Drop.
> (add_uses): Do not create MOps for addresses.  Do not mark
> non-REG non-MEM expressions as requiring resolution.
> (reverse_op): Record reverse as a cselib equivalence.
> (add_stores): Use it.  Do not create MOps for addresses.
> Do not require resolution for non-REG non-MEM expressions.
> Simplify support for reverse operations.
> (compute_bb_dataflow): Drop reverse support.
> (emit_notes_in_bb): Likewise.
> (create_entry_value): Rename to...
> (record_entry_value): ... this.  Use cselib equivalences.
> (vt_add_function_parameter): Adjust.

This (r182760) caused regressions in the libstdc++ testsuite for
cris-elf, PR51728.

brgds, H-P