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]

RFA/RFC: fix try_simplify_condjump (Was: RFA: Use fixup_fallthru_exit_predecessor only for (fwd))


On closer inspection, this patch is not obvious inasmuch as the test
cbranch_dest_block == EXIT_BLOCK_PTR
could be replaced by
jump_block->next_bb != cbranch_dest_block
to get the same effect.

The former makes it more clear why the test is needed, while the latter
will cause a quick return for a lot of cases that don't match.  OTOH,
the latter test is not as flexible if we later want to do basic block
reordering on the fly to suit whatever optimizations we want to do.

SO I am asking for either approval of this patch or a statement what
other test I should be using to make the check safe.

X-OriginalArrivalTime: 15 Jun 2004 23:12:29.0899 (UTC) FILETIME=[3B2359B0:01C4532E]

> $ /tmp/cvs/gcc-test-200406141500/Build/gcc/xgcc -B/tmp/cvs/gcc-test-200406141500/Build/gcc/ /tmp/cvs/gcc-test-200406141500/gcc/testsuite/gcc.c-torture/execute/20030120-2.c -w  -O1   -lm   -o /tmp/cvs/gcc-test-200406141500/Build/gcc/testsuite/20030120-2.x1
> $ /tmp/cvs/gcc-test-200406141500/Build/gcc/testsuite/20030120-2.x1

try_simplify_condjump uses can_fallthru to determine if one block precedes another.
This doesn't work any more when the latter block is the exit block.

2004-06-16  J"orn Rennecke <joern.rennecke@superh.com>

	* cfgcleanup.c (try_simplify_condjump): Update test to make
	sure we have a conditional branch around am unconditional branch.

Index: cfgcleanup.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cfgcleanup.c,v
retrieving revision 1.117
diff -p -r1.117 cfgcleanup.c
*** cfgcleanup.c	3 Jun 2004 12:07:38 -0000	1.117
--- cfgcleanup.c	15 Jun 2004 23:03:02 -0000
*************** try_simplify_condjump (basic_block cbran
*** 163,169 ****
       unconditional branch.  */
    cbranch_dest_block = cbranch_jump_edge->dest;
  
!   if (!can_fallthru (jump_block, cbranch_dest_block))
      return false;
  
    /* Invert the conditional branch.  */
--- 163,170 ----
       unconditional branch.  */
    cbranch_dest_block = cbranch_jump_edge->dest;
  
!   if (cbranch_dest_block == EXIT_BLOCK_PTR
!       || !can_fallthru (jump_block, cbranch_dest_block))
      return false;
  
    /* Invert the conditional branch.  */


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