dead_or_predictable

Jan Hubicka jh@suse.cz
Wed Jan 9 03:18:00 GMT 2002


Hi,
if_case 2 converison may result in conditional jumping to next instruction.
In such case we die due to duplicate edge.  Sorry for lact of testcase
but I was unable to simplify it to something trivial :(


Mit Jan  9 12:12:14 CET 2002  Jan Hubicka  <jh@suse.cz>
	* ifcvt.c (dead_or_predictable): Check dead edges.
Index: ifcvt.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/ifcvt.c,v
retrieving revision 1.75
diff -c -3 -p -r1.75 ifcvt.c
*** ifcvt.c	2001/11/27 09:07:59	1.75
--- ifcvt.c	2002/01/09 11:12:08
*************** dead_or_predicable (test_bb, merge_bb, o
*** 2647,2662 ****
    if (reversep)
      invert_br_probabilities (jump);
  
!   redirect_edge_succ (BRANCH_EDGE (test_bb), new_dest);
!   if (reversep)
      {
!       gcov_type count, probability;
!       count = BRANCH_EDGE (test_bb)->count;
!       BRANCH_EDGE (test_bb)->count = FALLTHRU_EDGE (test_bb)->count;
!       FALLTHRU_EDGE (test_bb)->count = count;
!       probability = BRANCH_EDGE (test_bb)->probability;
!       BRANCH_EDGE (test_bb)->probability = FALLTHRU_EDGE (test_bb)->probability;
!       FALLTHRU_EDGE (test_bb)->probability = probability;
      }
  
    /* Move the insns out of MERGE_BB to before the branch.  */
--- 2647,2673 ----
    if (reversep)
      invert_br_probabilities (jump);
  
!   /* We may result in conditional jumping to the next instruction.
!      Delete the duplicate edge.  */
! 
!   if (FALLTHRU_EDGE (test_bb)->dest == new_dest)
      {
!       FALLTHRU_EDGE (test_bb)->count += BRANCH_EDGE (test_bb)->count;
!       FALLTHRU_EDGE (test_bb)->probability = REG_BR_PROB_BASE;
!     }
!   else
!     {
!       redirect_edge_succ (BRANCH_EDGE (test_bb), new_dest);
!       if (reversep)
! 	{
! 	  gcov_type count, probability;
! 	  count = BRANCH_EDGE (test_bb)->count;
! 	  BRANCH_EDGE (test_bb)->count = FALLTHRU_EDGE (test_bb)->count;
! 	  FALLTHRU_EDGE (test_bb)->count = count;
! 	  probability = BRANCH_EDGE (test_bb)->probability;
! 	  BRANCH_EDGE (test_bb)->probability = FALLTHRU_EDGE (test_bb)->probability;
! 	  FALLTHRU_EDGE (test_bb)->probability = probability;
! 	}
      }
  
    /* Move the insns out of MERGE_BB to before the branch.  */



More information about the Gcc-patches mailing list