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]

Re: [tuples] [patch] Fix in_phi in verify_expr


>  Can we instead fold the PHI node verification into its only caller in
>  verify_stmts and get rid of the special casing in verify_expr?  Basically
>  in the FOR_EACH_PHI_ARG case manually verify what is valid here
>  (either is_gimple_val or is_gimple_min_invariant), instead of using
>  walk_tree (verify_expr) for this.

I think we can. Something like the attached patch is what you have in mind?

>  Thanks,
>  Richard.
>

Cheers,
-- 
Rafael Avila de Espindola

Google Ireland Ltd.
Gordon House
Barrow Street
Dublin 4
Ireland

Registered in Dublin, Ireland
Registration Number: 368047
Index: gcc/tree-cfg.c
===================================================================
--- gcc/tree-cfg.c	(revision 133789)
+++ gcc/tree-cfg.c	(working copy)
@@ -2814,7 +2814,6 @@
 verify_expr (tree *tp, int *walk_subtrees, void *data ATTRIBUTE_UNUSED)
 {
   tree t = *tp, x;
-  bool in_phi = (data != NULL);
 
   if (TYPE_P (t))
     *walk_subtrees = 0;
@@ -2865,16 +2864,6 @@
 	bool new_constant;
 	bool new_side_effects;
 
-        /* ??? tree-ssa-alias.c may have overlooked dead PHI nodes, missing
-	   dead PHIs that take the address of something.  But if the PHI
-	   result is dead, the fact that it takes the address of anything
-	   is irrelevant.  Because we can not tell from here if a PHI result
-	   is dead, we just skip this check for PHIs altogether.  This means
-	   we may be missing "valid" checks, but what can you do?
-	   This was PR19217.  */
-        if (in_phi)
-	  break;
-
 	old_invariant = TREE_INVARIANT (t);
 	old_constant = TREE_CONSTANT (t);
 	old_side_effects = TREE_SIDE_EFFECTS (t);
@@ -4005,12 +3994,25 @@
 		  err |= true;
 		}
 
-	      addr = walk_tree (&t, verify_expr, (void *) 1, NULL);
-	      if (addr)
+	      if (TREE_CODE (t) != ADDR_EXPR)
 		{
-		  debug_generic_expr (addr);
-		  err |= true;
+		  addr = walk_tree (&t, verify_expr, NULL, NULL);
+		  if (addr)
+		    {
+		      debug_generic_expr (addr);
+		      err |= true;
+		    }
 		}
+	      else
+		{
+	 /* ??? tree-ssa-alias.c may have overlooked dead PHI nodes, missing
+	   dead PHIs that take the address of something.  But if the PHI
+	   result is dead, the fact that it takes the address of anything
+	   is irrelevant.  Because we can not tell from here if a PHI result
+	   is dead, we just skip this check for PHIs altogether.  This means
+	   we may be missing "valid" checks, but what can you do?
+	   This was PR19217.  */
+		}
 
 	      addr = walk_tree (&t, verify_node_sharing, visited, NULL);
 	      if (addr)

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