This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH, committed] Fix PR 48272


Hello,

This is the case when sched-pressure support is not ready for new insns appearing during scheduling. (Found with the crazy set of options on ia64, where register pressure is not much of an issue.) Anyways, the fix is simply initializing the proper data structures at the point where new insns are created. Bootstrapped and tested on x86-64 and ia64, approved by Vlad in the PR audit trail, committed to trunk as r172183. Port to 4.6 will follow on the next week.

Andrey

Index: gcc/ChangeLog
===================================================================
*** gcc/ChangeLog       (revision 172182)
--- gcc/ChangeLog       (revision 172183)
***************
*** 1,3 ****
--- 1,13 ----
+ 2011-04-08  Andrey Belevantsev  <abel@ispras.ru>
+
+       PR rtl-optimization/48272
+
+       * sched-deps.c (setup_insn_reg_pressure_info): Export and rename to
+       init_insn_reg_pressure_info.  Adjust a caller.
+       * sched-int.h (init_insn_reg_pressure_info): Declare.
+       * haifa-sched.c (haifa_init_insn): Call init_insn_reg_pressure_info
+       when sched-pressure is enabled.
+
  2011-04-08  Richard Guenther  <rguenther@suse.de>

        * gimple.c (gimple_set_modified): Do not queue calls to
Index: gcc/testsuite/ChangeLog
===================================================================
*** gcc/testsuite/ChangeLog     (revision 172182)
--- gcc/testsuite/ChangeLog     (revision 172183)
***************
*** 1,3 ****
--- 1,8 ----
+ 2011-04-08  Andrey Belevantsev  <abel@ispras.ru>
+
+       PR rtl-optimization/48272
+       * g++.dg/opt/pr48272.C: New.
+
  2011-04-08  Dmitry Melnik  <dm@ispras.ru>

PR rtl-optimization/48235
Index: gcc/testsuite/g++.dg/opt/pr48272.C
===================================================================
*** gcc/testsuite/g++.dg/opt/pr48272.C (revision 0)
--- gcc/testsuite/g++.dg/opt/pr48272.C (revision 172183)
***************
*** 0 ****
--- 1,130 ----
+ // { dg-do compile }
+ // { dg-options "-O3 -ftracer -fsched-pressure -Wno-unused-parameter -Wno-return-type" }
+
+ extern "C"
+ {
+ namespace std
+ {
+ class exception
+ {
+ virtual const char *what () const throw ();
+ };
+ }
+ }
+ namespace std __attribute__ ((__visibility__ ("default")))
+ {
+ template < typename _Alloc > class allocator;
+ template < class _CharT > struct char_traits;
+ template < typename _CharT, typename _Traits =
+ char_traits < _CharT >, typename _Alloc =
+ allocator < _CharT > >class basic_string;
+ typedef basic_string < char >string;
+ template < typename _CharT, typename _Traits =
+ char_traits < _CharT > >class basic_ios;
+ typedef basic_ios < char >ios;
+ }
+
+ namespace __gnu_cxx __attribute__ ((__visibility__ ("default")))
+ {
+ template < typename _Tp > class new_allocator
+ {
+ };
+ }
+
+ namespace std __attribute__ ((__visibility__ ("default")))
+ {
+ template < typename _Tp > class allocator:public __gnu_cxx::new_allocator <
+ _Tp >
+ {
+ };
+ }
+
+ typedef int _Atomic_word;
+ namespace __gnu_cxx __attribute__ ((__visibility__ ("default")))
+ {
+ static inline _Atomic_word
+ __attribute__ ((__unused__)) __exchange_and_add_dispatch (_Atomic_word *
+ __mem,
+ int __val)
+ {
+ }
+ }
+
+ namespace std __attribute__ ((__visibility__ ("default")))
+ {
+ template < typename _CharT, typename _Traits,
+ typename _Alloc > class basic_string
+ {
+ typedef _Alloc allocator_type;
+ private:struct _Rep_base
+ {
+ _Atomic_word _M_refcount;
+ };
+ struct _Rep:_Rep_base
+ {
+ void _M_dispose (const _Alloc & __a)
+ {
+ if (__builtin_expect (this != &_S_empty_rep (), false))
+ {
+ if (__gnu_cxx::
+ __exchange_and_add_dispatch (&this->_M_refcount, -1) <= 0)
+ {
+ _M_destroy (__a);
+ }
+ }
+ }
+ void _M_destroy (const _Alloc &) throw ();
+ };
+ struct _Alloc_hider:_Alloc
+ {
+ _CharT *_M_p;
+ };
+ private:mutable _Alloc_hider _M_dataplus;
+ _CharT *_M_data () const
+ {
+ return _M_dataplus._M_p;
+ }
+ _Rep *_M_rep () const
+ {
+ return &((reinterpret_cast < _Rep * >(_M_data ()))[-1]);
+ }
+ static _Rep & _S_empty_rep ()
+ {
+ }
+ public: basic_string ():_M_dataplus (_S_empty_rep ()._M_refdata (),
+ _Alloc ())
+ {
+ }
+ basic_string (const _CharT * __s, const _Alloc & __a = _Alloc ());
+ ~basic_string ()
+ {
+ _M_rep ()->_M_dispose (this->get_allocator ());
+ }
+ allocator_type get_allocator () const
+ {
+ }
+ };
+ class ios_base
+ {
+ public:class failure:public exception
+ {
+ public:explicit failure (const string & __str) throw ();
+ };
+ };
+ template < typename _CharT, typename _Traits > class basic_ios:public
+ ios_base
+ {
+ };
+ namespace iostreams
+ {
+ class zlib_error:public std::ios::failure
+ {
+ public:explicit zlib_error (int error);
+ private:int error_;
+ };
+ zlib_error::zlib_error (int error):std::ios::failure ("zlib error"),
+ error_ (error)
+ {
+ }
+ }
+ }
Index: gcc/haifa-sched.c
===================================================================
*** gcc/haifa-sched.c (revision 172182)
--- gcc/haifa-sched.c (revision 172183)
*************** haifa_init_insn (rtx insn)
*** 5611,5616 ****
--- 5611,5618 ----
/* Extend dependency caches by one element. */
extend_dependency_caches (1, false);
}
+ if (sched_pressure_p)
+ init_insn_reg_pressure_info (insn);
}


  /* Init data for the new basic block BB which comes after AFTER.  */
Index: gcc/sched-deps.c
===================================================================
*** gcc/sched-deps.c    (revision 172182)
--- gcc/sched-deps.c    (revision 172183)
*************** mark_insn_reg_clobber (rtx reg, const_rt
*** 1991,1998 ****
  }

  /* Set up reg pressure info related to INSN.  */
! static void
! setup_insn_reg_pressure_info (rtx insn)
  {
    int i, len;
    enum reg_class cl;
--- 1991,1998 ----
  }

  /* Set up reg pressure info related to INSN.  */
! void
! init_insn_reg_pressure_info (rtx insn)
  {
    int i, len;
    enum reg_class cl;
*************** sched_analyze_insn (struct deps_desc *de
*** 2774,2780 ****
    if (sched_pressure_p)
      {
        setup_insn_reg_uses (deps, insn);
!       setup_insn_reg_pressure_info (insn);
      }

    /* Add register dependencies for insn.  */
--- 2774,2780 ----
    if (sched_pressure_p)
      {
        setup_insn_reg_uses (deps, insn);
!       init_insn_reg_pressure_info (insn);
      }

    /* Add register dependencies for insn.  */
Index: gcc/sched-int.h
===================================================================
*** gcc/sched-int.h     (revision 172182)
--- gcc/sched-int.h     (revision 172183)
*************** extern void init_deps_global (void);
*** 1194,1199 ****
--- 1194,1200 ----
  extern void finish_deps_global (void);
  extern void deps_analyze_insn (struct deps_desc *, rtx);
  extern void remove_from_deps (struct deps_desc *, rtx);
+ extern void init_insn_reg_pressure_info (rtx);

  extern dw_t get_dep_weak_1 (ds_t, ds_t);
  extern dw_t get_dep_weak (ds_t, ds_t);


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]