This is the mail archive of the gcc-bugs@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]

[Bug tree-optimization/16808] [3.5 Regression] verify_ssa failed: Missing definition for SSA_NAME


------- Additional Comments From zhangjie at magima dot com dot cn  2004-08-02 15:07 -------
How about this patch? Are there other variables that need be renamed?


2004-08-02  Jie Zhang  <zhangjie@magima.com.cn>

	* tree-ssa-ccp.c (execute_fold_all_builtins): Rename the affected vars
	in V_MAY_DEFS after folding builtins.
	(struct tree_opt_pass pass_fold_builtins): Add TODO_rename_vars in
	todo_flags_finish.


Index: tree-ssa-ccp.c
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/tree-ssa-ccp.c,v
retrieving revision 2.29
diff -u -p -r2.29 tree-ssa-ccp.c
--- tree-ssa-ccp.c	30 Jul 2004 22:55:25 -0000	2.29
+++ tree-ssa-ccp.c	2 Aug 2004 14:55:50 -0000
@@ -2653,11 +2653,11 @@ execute_fold_all_builtins (void)
   basic_block bb;
   FOR_EACH_BB (bb)
     {
-      block_stmt_iterator i;
-      for (i = bsi_start (bb); !bsi_end_p (i); bsi_next (&i))
+      block_stmt_iterator bsi;
+      for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
 	{
-	  tree *stmtp = bsi_stmt_ptr (i);
-	  tree call = get_rhs (*stmtp);
+	  tree stmt = bsi_stmt (bsi);
+	  tree call = get_rhs (stmt);
 	  tree callee, result;
 
 	  if (!call || TREE_CODE (call) != CALL_EXPR)
@@ -2666,7 +2666,7 @@ execute_fold_all_builtins (void)
 	  if (!callee || DECL_BUILT_IN_CLASS (callee) != BUILT_IN_NORMAL)
 	    continue;
 
-	  result = ccp_fold_builtin (*stmtp, call);
+	  result = ccp_fold_builtin (stmt, call);
 	  if (!result)
 	    switch (DECL_FUNCTION_CODE (callee))
 	      {
@@ -2684,16 +2684,31 @@ execute_fold_all_builtins (void)
 	  if (dump_file && (dump_flags & TDF_DETAILS))
 	    {
 	      fprintf (dump_file, "Simplified\n  ");
-	      print_generic_stmt (dump_file, *stmtp, dump_flags);
+	      print_generic_stmt (dump_file, stmt, dump_flags);
 	    }
 
-	  if (set_rhs (stmtp, result))
-	    modify_stmt (*stmtp);
+	  if (set_rhs (&stmt, result))
+	    {
+	      size_t i;
+	      stmt_ann_t ann;
+	      v_may_def_optype v_may_defs;
+
+	      ann = stmt_ann (stmt);
+	      v_may_defs = V_MAY_DEF_OPS (ann);
+	      for (i = 0; i < NUM_V_MAY_DEFS (v_may_defs); i++)
+		{
+		  tree op = V_MAY_DEF_RESULT (v_may_defs, i);
+		  tree var = SSA_NAME_VAR (op);
+		  bitmap_set_bit (vars_to_rename, var_ann (var)->uid);
+		}
+
+	      modify_stmt (stmt);
+	    }
 
 	  if (dump_file && (dump_flags & TDF_DETAILS))
 	    {
 	      fprintf (dump_file, "to\n  ");
-	      print_generic_stmt (dump_file, *stmtp, dump_flags);
+	      print_generic_stmt (dump_file, stmt, dump_flags);
 	      fprintf (dump_file, "\n");
 	    }
 	}
@@ -2714,6 +2729,7 @@ struct tree_opt_pass pass_fold_builtins 
   0,					/* properties_destroyed */
   0,					/* todo_flags_start */
   TODO_dump_func | TODO_verify_ssa	/* todo_flags_finish */
+    | TODO_rename_vars
 };
 
 


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16808


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