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] Fix PR45056


The scheduler ends up asking the alias-oracle about MEMs in
debug insns.  But those are not canonical, so make sure
to make them (more) so.

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

Richard.

2010-07-26  Richard Guenther  <rguenther@suse.de>

	PR middle-end/45056
	* gimple-fold.c (fold_stmt_1): Also fold references in
	debug stmts.

	* g++.dg/pr45056.C: New testcase.

Index: gcc/gimple-fold.c
===================================================================
*** gcc/gimple-fold.c	(revision 162526)
--- gcc/gimple-fold.c	(working copy)
*************** fold_stmt_1 (gimple_stmt_iterator *gsi,
*** 1530,1535 ****
--- 1530,1552 ----
  	}
        break;
  
+     case GIMPLE_DEBUG:
+       if (gimple_debug_bind_p (stmt))
+ 	{
+ 	  tree val = gimple_debug_bind_get_value (stmt);
+ 	  if (val
+ 	      && REFERENCE_CLASS_P (val))
+ 	    {
+ 	      tree tem = maybe_fold_reference (val, false);
+ 	      if (tem)
+ 		{
+ 		  gimple_debug_bind_set_value (stmt, tem);
+ 		  changed = true;
+ 		}
+ 	    }
+ 	}
+       break;
+ 
      default:;
      }
  
Index: gcc/testsuite/g++.dg/pr45056.C
===================================================================
*** gcc/testsuite/g++.dg/pr45056.C	(revision 0)
--- gcc/testsuite/g++.dg/pr45056.C	(revision 0)
***************
*** 0 ****
--- 1,54 ----
+ /* { dg-do compile } */
+ /* { dg-options "-O -fschedule-insns2 -fschedule-insns -g" } */
+ 
+ template < class _T1, class _T2 > struct pair
+ {
+   _T1 first;
+   _T2 second;
+   pair (_T1 & __a, _T2 & __b)
+       :first (__a), second (__b)   
+     {    }
+ }
+ ;
+ template < typename _Tp > struct _Vector_base
+ {
+   ~_Vector_base ();
+ }
+ ;
+ template < typename _Tp>struct vector
+ : _Vector_base < _Tp>
+ {
+   template    <    typename     _ForwardIterator >   inline     void _Destroy (_ForwardIterator)   {  }
+   _Tp * _M_finish;
+   ~vector ()
+     {
+       _Destroy 	( this->_M_finish);
+     }
+ }   ;
+ template < typename ITV > struct Box
+ {
+   Box (const Box &);
+   Box ();
+   typedef vector < ITV > Sequence;
+   Sequence seq;
+ };
+ template < typename D > struct Powerset
+ {
+   Powerset (const Powerset &y) :reduced (y.reduced) {}
+   bool reduced;
+ } ;
+ template < typename PS > struct Pointset_Powerset :Powerset <  int >
+ {
+   Pointset_Powerset ();
+   int space_dim;
+ } ;
+ pair
+ <
+ Box<int>,
+ Pointset_Powerset < int > >
+ linear_partition ()
+ {
+   Pointset_Powerset < int > r ;
+   Box<int> qq;
+   return pair<Box<int>,Pointset_Powerset < int > >  (qq, r);
+ }


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