For PHIs we call walk_tree with a function that expects to be
called from walk_gimple_op ...

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

Richard.

2013-01-11  Richard Biener  <rguent...@suse.de>

        * tree-cfg.c (verify_node_sharing_1): Split out from ...
        (verify_node_sharing): ... here.
        (verify_gimple_in_cfg): Use verify_node_sharing_1 for walk_tree.

Index: gcc/tree-cfg.c
===================================================================
*** gcc/tree-cfg.c      (revision 195103)
--- gcc/tree-cfg.c      (working copy)
*************** tree_node_can_be_shared (tree t)
*** 4462,4474 ****
    return false;
  }
  
! /* Called via walk_gimple_stmt.  Verify tree sharing.  */
  
  static tree
! verify_node_sharing (tree *tp, int *walk_subtrees, void *data)
  {
!   struct walk_stmt_info *wi = (struct walk_stmt_info *) data;
!   struct pointer_set_t *visited = (struct pointer_set_t *) wi->info;
  
    if (tree_node_can_be_shared (*tp))
      {
--- 4482,4493 ----
    return false;
  }
  
! /* Called via walk_tree.  Verify tree sharing.  */
  
  static tree
! verify_node_sharing_1 (tree *tp, int *walk_subtrees, void *data)
  {
!   struct pointer_set_t *visited = (struct pointer_set_t *) data;
  
    if (tree_node_can_be_shared (*tp))
      {
*************** verify_node_sharing (tree *tp, int *walk
*** 4482,4487 ****
--- 4501,4515 ----
    return NULL;
  }
  
+ /* Called via walk_gimple_stmt.  Verify tree sharing.  */
+ 
+ static tree
+ verify_node_sharing (tree *tp, int *walk_subtrees, void *data)
+ {
+   struct walk_stmt_info *wi = (struct walk_stmt_info *) data;
+   return verify_node_sharing_1 (tp, walk_subtrees, wi->info);
+ }
+ 
  static bool eh_error_found;
  static int
  verify_eh_throw_stmt_node (void **slot, void *data)
*************** verify_gimple_in_cfg (struct function *f
*** 4534,4540 ****
          for (i = 0; i < gimple_phi_num_args (phi); i++)
            {
              tree arg = gimple_phi_arg_def (phi, i);
!             tree addr = walk_tree (&arg, verify_node_sharing, visited, NULL);
              if (addr)
                {
                  error ("incorrect sharing of tree nodes");
--- 4562,4569 ----
          for (i = 0; i < gimple_phi_num_args (phi); i++)
            {
              tree arg = gimple_phi_arg_def (phi, i);
!             tree addr = walk_tree (&arg, verify_node_sharing_1,
!                                    visited, NULL);
              if (addr)
                {
                  error ("incorrect sharing of tree nodes");

Reply via email to