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 PR37617


We shouldn't insert to PRE sets during FRE.

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

Richard.

2008-10-01  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/37617
	* tree-ssa-pre.c (create_expression_by_pieces): During FRE
	do not add to the NEW_SETS.

	* gcc.c-torture/compile/pr37617.c: New testcase.

Index: tree-ssa-pre.c
===================================================================
*** tree-ssa-pre.c	(revision 140810)
--- tree-ssa-pre.c	(working copy)
*************** create_expression_by_pieces (basic_block
*** 2885,2891 ****
  	      VN_INFO (forcedname)->value_id = get_next_value_id ();
  	      nameexpr = get_or_alloc_expr_for_name (forcedname);
  	      add_to_value (VN_INFO (forcedname)->value_id, nameexpr);
! 	      bitmap_value_replace_in_set (NEW_SETS (block), nameexpr);
  	      bitmap_value_replace_in_set (AVAIL_OUT (block), nameexpr);
  	    }
  	  mark_symbols_for_renaming (stmt);
--- 2885,2892 ----
  	      VN_INFO (forcedname)->value_id = get_next_value_id ();
  	      nameexpr = get_or_alloc_expr_for_name (forcedname);
  	      add_to_value (VN_INFO (forcedname)->value_id, nameexpr);
! 	      if (!in_fre)
! 		bitmap_value_replace_in_set (NEW_SETS (block), nameexpr);
  	      bitmap_value_replace_in_set (AVAIL_OUT (block), nameexpr);
  	    }
  	  mark_symbols_for_renaming (stmt);
Index: testsuite/gcc.c-torture/compile/pr37617.c
===================================================================
*** testsuite/gcc.c-torture/compile/pr37617.c	(revision 0)
--- testsuite/gcc.c-torture/compile/pr37617.c	(revision 0)
***************
*** 0 ****
--- 1,19 ----
+ typedef union
+ {
+   char *string;
+   double dval;
+   float fval;
+ } yystype;
+ char *f(void)
+ {
+   yystype tok;
+   tok.dval = 0;
+   return (tok.string);
+ }
+ char *f1(void)
+ {
+   yystype tok;
+   tok.fval = 0;
+   return (tok.string);
+ }
+ 


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