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 GO bootstrap (?)


The following patch should fix Go bootstrap.  We need to preserve
virtual SSA form properly during EH cleanup and for the
cleanup_empty_eh_merge_phis the same arguments that hold for
real variables should hold for virtual operands - they are not
changed by empty EH handlers and thus we can simply re-use them.

Bootstrap / regtest pending on x86_64-unknown-linux-gnu.

Richard.

Index: gcc/tree-eh.c
===================================================================
*** gcc/tree-eh.c	(revision 198522)
--- gcc/tree-eh.c	(working copy)
*************** cleanup_empty_eh_merge_phis (basic_block
*** 3949,3955 ****
    gimple_stmt_iterator ngsi, ogsi;
    edge_iterator ei;
    edge e;
-   bitmap rename_virts;
    bitmap ophi_handled;
  
    /* The destination block must not be a regular successor for any
--- 3949,3954 ----
*************** cleanup_empty_eh_merge_phis (basic_block
*** 3972,3978 ****
      redirect_edge_var_map_clear (e);
  
    ophi_handled = BITMAP_ALLOC (NULL);
-   rename_virts = BITMAP_ALLOC (NULL);
  
    /* First, iterate through the PHIs on NEW_BB and set up the edge_var_map
       for the edges we're going to move.  */
--- 3971,3976 ----
*************** cleanup_empty_eh_merge_phis (basic_block
*** 4025,4035 ****
  	      redirect_edge_var_map_add (e, nresult, oop, oloc);
  	    }
  	}
!       /* If we didn't find the PHI, but it's a VOP, remember to rename
! 	 it later, assuming all other tests succeed.  */
!       else if (virtual_operand_p (nresult))
! 	bitmap_set_bit (rename_virts, SSA_NAME_VERSION (nresult));
!       /* If we didn't find the PHI, and it's a real variable, we know
  	 from the fact that OLD_BB is tree_empty_eh_handler_p that the
  	 variable is unchanged from input to the block and we can simply
  	 re-use the input to NEW_BB from the OLD_BB_OUT edge.  */
--- 4023,4029 ----
  	      redirect_edge_var_map_add (e, nresult, oop, oloc);
  	    }
  	}
!       /* If we didn't find the PHI, if it's a real variable or a VOP, we know
  	 from the fact that OLD_BB is tree_empty_eh_handler_p that the
  	 variable is unchanged from input to the block and we can simply
  	 re-use the input to NEW_BB from the OLD_BB_OUT edge.  */
*************** cleanup_empty_eh_merge_phis (basic_block
*** 4052,4075 ****
  	goto fail;
      }
  
-   /* At this point we know that the merge will succeed.  Remove the PHI
-      nodes for the virtuals that we want to rename.  */
-   if (!bitmap_empty_p (rename_virts))
-     {
-       for (ngsi = gsi_start_phis (new_bb); !gsi_end_p (ngsi); )
- 	{
- 	  gimple nphi = gsi_stmt (ngsi);
- 	  tree nresult = gimple_phi_result (nphi);
- 	  if (bitmap_bit_p (rename_virts, SSA_NAME_VERSION (nresult)))
- 	    {
- 	      mark_virtual_phi_result_for_renaming (nphi);
- 	      remove_phi_node (&ngsi, true);
- 	    }
- 	  else
- 	    gsi_next (&ngsi);
- 	}
-     }
- 
    /* Finally, move the edges and update the PHIs.  */
    for (ei = ei_start (old_bb->preds); (e = ei_safe_edge (ei)); )
      if (e->flags & EDGE_EH)
--- 4046,4051 ----
*************** cleanup_empty_eh_merge_phis (basic_block
*** 4097,4110 ****
        ei_next (&ei);
  
    BITMAP_FREE (ophi_handled);
-   BITMAP_FREE (rename_virts);
    return true;
  
   fail:
    FOR_EACH_EDGE (e, ei, old_bb->preds)
      redirect_edge_var_map_clear (e);
    BITMAP_FREE (ophi_handled);
-   BITMAP_FREE (rename_virts);
    return false;
  }
  
--- 4073,4084 ----
*************** struct gimple_opt_pass pass_cleanup_eh =
*** 4467,4473 ****
     0,				/* properties_provided */
     0,				/* properties_destroyed */
     0,				/* todo_flags_start */
!    0             		/* todo_flags_finish */
     }
  };
  
--- 4441,4447 ----
     0,				/* properties_provided */
     0,				/* properties_destroyed */
     0,				/* todo_flags_start */
!    TODO_verify_ssa    		/* todo_flags_finish */
     }
  };
  


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