From patchwork Mon Oct 29 14:46:48 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: patch to fix PR55106 From: Vladimir Makarov X-Patchwork-Id: 195020 Message-Id: <508E96D8.2090403@redhat.com> To: "H.J. Lu" Cc: GCC Patches Date: Mon, 29 Oct 2012 10:46:48 -0400 On 12-10-28 8:49 PM, H.J. Lu wrote: > On Sun, Oct 28, 2012 at 5:43 PM, Vladimir Makarov wrote: >> The following patch fixes PR55106. A value in GENERAL_REGS is inherited >> into a move with destination pseudo of SSE_REGS. It results into secondary >> move for which inheritance is tried again an again. It means cycling LRA >> passes. >> >> The patch was successfully bootstrapped on x86/x86-64. >> >> Committed as rev. 192904. >> >> 2012-10-28 Vladimir Makarov >> >> PR rtl-optimization/55106 >> * lra-constraints.c (skip_usage_debug_insns): New function. >> (check_secondary_memory_needed_p): Ditto. >> (inherit_reload_reg): Use the new functions. Improve debug >> output. >> > Please add the testcase at > > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55106#c1 > I've committed the following patch. 2012-10-29 Vladimir Makarov PR rtl-optimization/55106 * g++.dg/pr55106.C: New. > Index: testsuite/g++.dg/pr55106.C =================================================================== --- testsuite/g++.dg/pr55106.C (revision 0) +++ testsuite/g++.dg/pr55106.C (working copy) @@ -0,0 +1,67 @@ +/* { dg-do compile } */ +/* { dg-options "-c -O3" } */ +template struct A { + typedef _Tp *pointer; + typedef _Tp& reference; + typedef _Tp& const_reference; + templatestruct rebind + { + typedef A other; + }; +}; + +templatestruct __alloc_traits +{ + typedef typename _Alloc::pointer pointer; + typedef typename _Alloc::reference reference; + typedef typename _Alloc::const_reference const_reference; + templatestruct rebind + { + typedef typename _Alloc::template rebind<_Tp>::other other; + }; +}; +templatestruct B +{ + typedef typename __alloc_traits<_Alloc>::template rebind< + _Tp>::other _Tp_alloc_type; + typedef typename __alloc_traits<_Tp_alloc_type>::pointer pointer; + struct F + { + pointer _M_start; + }; + F _M_impl; +}; +template >class vec : B<_Tp, _Alloc>{ + typedef B<_Tp, _Alloc> _Base; + typedef typename _Base::_Tp_alloc_type _Tp_alloc_type; + typedef __alloc_traits<_Tp_alloc_type> _Alloc_traits; + +public: + typedef _Tp value_type; + typedef typename _Alloc_traits::reference reference; + typedef typename _Alloc_traits::const_reference const_reference; + reference operator[](int p1) + { + return *(this->_M_impl._M_start + p1); + } + + const_reference operator[](long) const; +}; + +int a[17]; +class C { + vec m_value; + void opModDivGuts(const C&); + int mostSetBitP1() const; +}; +void C::opModDivGuts(const C& p1) +{ + int b = p1.mostSetBitP1(), c = b + 1; + int d[16]; + + for (int i = c; i; i--) + a[i] = p1.m_value[i] << b; + + for (int i = 0; i < c; i++) + m_value[i] = d[i] >> b << -b; +}