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 PR70725 (followup to Mareks patch)


The following fixes the followup ICEs in the testcase for PR70725
where Markes patch only fixed the first one.

Bootstrapped on x86_64-unknown-linux-gnu, testing in progress.

Jakub - the patch should be safe in that any testcase running into
the changed paths now would have caused SSA verifications without
the patch.  There's still the question what to do for GCC 6.1 - we
can revert Mareks patch or apply this one ontop.  I don't have a
strong opinion here.

Richard.

2016-04-21  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/70725
	* tree-if-conv.c (if_convertible_phi_p): Adjust guard
	for phi_convertible_by_degenerating_args.
	(predicate_all_scalar_phis): Handle single-argument PHIs.

Index: gcc/tree-if-conv.c
===================================================================
*** gcc/tree-if-conv.c	(revision 235305)
--- gcc/tree-if-conv.c	(working copy)
*************** if_convertible_phi_p (struct loop *loop,
*** 659,665 ****
  
    if (bb != loop->header)
      {
!       if (gimple_phi_num_args (phi) != 2
  	  && !aggressive_if_conv
  	  && !phi_convertible_by_degenerating_args (phi))
  	{
--- 659,665 ----
  
    if (bb != loop->header)
      {
!       if (gimple_phi_num_args (phi) > 2
  	  && !aggressive_if_conv
  	  && !phi_convertible_by_degenerating_args (phi))
  	{
*************** predicate_all_scalar_phis (struct loop *
*** 1911,1930 ****
        if (bb == loop->header)
  	continue;
  
-       if (EDGE_COUNT (bb->preds) == 1)
- 	continue;
- 
        phi_gsi = gsi_start_phis (bb);
        if (gsi_end_p (phi_gsi))
  	continue;
  
!       gsi = gsi_after_labels (bb);
!       while (!gsi_end_p (phi_gsi))
  	{
! 	  phi = phi_gsi.phi ();
! 	  predicate_scalar_phi (phi, &gsi);
! 	  release_phi_node (phi);
! 	  gsi_next (&phi_gsi);
  	}
  
        set_phi_nodes (bb, NULL);
--- 1911,1941 ----
        if (bb == loop->header)
  	continue;
  
        phi_gsi = gsi_start_phis (bb);
        if (gsi_end_p (phi_gsi))
  	continue;
  
!       if (EDGE_COUNT (bb->preds) == 1)
  	{
! 	  /* Propagate degenerate PHIs.  */
! 	  for (phi_gsi = gsi_start_phis (bb); !gsi_end_p (phi_gsi);
! 	       gsi_next (&phi_gsi))
! 	    {
! 	      gphi *phi = phi_gsi.phi ();
! 	      replace_uses_by (gimple_phi_result (phi),
! 			       gimple_phi_arg_def (phi, 0));
! 	    }
! 	}
!       else
! 	{
! 	  gsi = gsi_after_labels (bb);
! 	  while (!gsi_end_p (phi_gsi))
! 	    {
! 	      phi = phi_gsi.phi ();
! 	      predicate_scalar_phi (phi, &gsi);
! 	      release_phi_node (phi);
! 	      gsi_next (&phi_gsi);
! 	    }
  	}
  
        set_phi_nodes (bb, NULL);


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