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 PR47639


This fixes generic vector lowering to clean EH info on the resulting
vector constructor (but leaves PR47645 in place, which isn't a 
regression).

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

Richard.

2011-02-08  Richard Guenther  <rguenther@suse.de>

	PR middle-end/47639
	* tree-vect-generic.c (expand_vector_operations_1): Update
	stmts here ...
	(expand_vector_operations): ... not here.  Cleanup EH info
	and the CFG if required.

	* g++.dg/opt/pr47639.c: New testcase.

Index: gcc/tree-vect-generic.c
===================================================================
*** gcc/tree-vect-generic.c	(revision 169917)
--- gcc/tree-vect-generic.c	(working copy)
*************** expand_vector_operations_1 (gimple_stmt_
*** 606,613 ****
       way to do it is change expand_vector_operation and its callees to
       return a tree_code, RHS1 and RHS2 instead of a tree. */
    gimple_assign_set_rhs_from_tree (gsi, new_rhs);
! 
!   gimple_set_modified (gsi_stmt (*gsi), true);
  }
  
  /* Use this to lower vector operations introduced by the vectorizer,
--- 606,612 ----
       way to do it is change expand_vector_operation and its callees to
       return a tree_code, RHS1 and RHS2 instead of a tree. */
    gimple_assign_set_rhs_from_tree (gsi, new_rhs);
!   update_stmt (gsi_stmt (*gsi));
  }
  
  /* Use this to lower vector operations introduced by the vectorizer,
*************** expand_vector_operations (void)
*** 624,639 ****
  {
    gimple_stmt_iterator gsi;
    basic_block bb;
  
    FOR_EACH_BB (bb)
      {
        for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
  	{
  	  expand_vector_operations_1 (&gsi);
! 	  update_stmt_if_modified (gsi_stmt (gsi));
  	}
      }
!   return 0;
  }
  
  struct gimple_opt_pass pass_lower_vector =
--- 623,646 ----
  {
    gimple_stmt_iterator gsi;
    basic_block bb;
+   bool cfg_changed = false;
  
    FOR_EACH_BB (bb)
      {
        for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
  	{
  	  expand_vector_operations_1 (&gsi);
! 	  /* ???  If we do not cleanup EH then we will ICE in
! 	     verification.  But in reality we have created wrong-code
! 	     as we did not properly transition EH info and edges to
! 	     the piecewise computations.  */
! 	  if (maybe_clean_eh_stmt (gsi_stmt (gsi))
! 	      && gimple_purge_dead_eh_edges (bb))
! 	    cfg_changed = true;
  	}
      }
! 
!   return cfg_changed ? TODO_cleanup_cfg : 0;
  }
  
  struct gimple_opt_pass pass_lower_vector =
Index: gcc/testsuite/g++.dg/opt/pr47639.c
===================================================================
*** gcc/testsuite/g++.dg/opt/pr47639.c	(revision 0)
--- gcc/testsuite/g++.dg/opt/pr47639.c	(revision 0)
***************
*** 0 ****
--- 1,17 ----
+ // { dg-do compile }
+ // { dg-options "-fnon-call-exceptions" }
+ 
+ typedef int __attribute__ ((vector_size (8))) vec;
+ 
+ vec foo (vec v1, vec v2)
+ {
+   try
+     {
+       return v1 / v2;
+     }
+   catch (...)
+     {
+       throw;
+     }
+ }
+ 


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