From 19ac78921e8351a7b4b96c0b404d30dbbfb4f80d Mon Sep 17 00:00:00 2001 From: Andrey Belevantsev Date: Fri, 8 Apr 2011 17:25:29 +0400 Subject: [PATCH] re PR rtl-optimization/48272 (internal compiler error: in setup_insn_reg_pressure_info, at haifa-sched.c:1124) 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. * g++.dg/opt/pr48272.C: New. From-SVN: r172183 --- gcc/ChangeLog | 10 +++ gcc/haifa-sched.c | 2 + gcc/sched-deps.c | 6 +- gcc/sched-int.h | 1 + gcc/testsuite/ChangeLog | 5 ++ gcc/testsuite/g++.dg/opt/pr48272.C | 130 +++++++++++++++++++++++++++++ 6 files changed, 151 insertions(+), 3 deletions(-) create mode 100644 gcc/testsuite/g++.dg/opt/pr48272.C diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d323a62e80e..107f79bf2ff 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2011-04-08 Andrey Belevantsev + + 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 * gimple.c (gimple_set_modified): Do not queue calls to diff --git a/gcc/haifa-sched.c b/gcc/haifa-sched.c index 30f55be5178..6908a113e63 100644 --- a/gcc/haifa-sched.c +++ b/gcc/haifa-sched.c @@ -5611,6 +5611,8 @@ haifa_init_insn (rtx insn) /* 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. */ diff --git a/gcc/sched-deps.c b/gcc/sched-deps.c index dcee0190490..393e651f3df 100644 --- a/gcc/sched-deps.c +++ b/gcc/sched-deps.c @@ -1991,8 +1991,8 @@ mark_insn_reg_clobber (rtx reg, const_rtx setter, void *data) } /* Set up reg pressure info related to INSN. */ -static void -setup_insn_reg_pressure_info (rtx insn) +void +init_insn_reg_pressure_info (rtx insn) { int i, len; enum reg_class cl; @@ -2774,7 +2774,7 @@ sched_analyze_insn (struct deps_desc *deps, rtx x, rtx insn) if (sched_pressure_p) { setup_insn_reg_uses (deps, insn); - setup_insn_reg_pressure_info (insn); + init_insn_reg_pressure_info (insn); } /* Add register dependencies for insn. */ diff --git a/gcc/sched-int.h b/gcc/sched-int.h index d5add3bf218..d5c9509f61a 100644 --- a/gcc/sched-int.h +++ b/gcc/sched-int.h @@ -1194,6 +1194,7 @@ extern void init_deps_global (void); 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); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 65440e2b2d9..acd66d099de 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2011-04-08 Andrey Belevantsev + + PR rtl-optimization/48272 + * g++.dg/opt/pr48272.C: New. + 2011-04-08 Dmitry Melnik PR rtl-optimization/48235 diff --git a/gcc/testsuite/g++.dg/opt/pr48272.C b/gcc/testsuite/g++.dg/opt/pr48272.C new file mode 100644 index 00000000000..cb28a1bb4e3 --- /dev/null +++ b/gcc/testsuite/g++.dg/opt/pr48272.C @@ -0,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) + { + } + } +}