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]

[3.3] PR opt/12082


Hi,
the attached patch avoids the warning in this particular case, but it
seems to me that there are quite a bit of other oppurtunities for such a
problem to show up.  I hope that tree-ssa branch will have better answer
for implementing such a warning.

Honza

Sat Sep  6 09:44:40 CEST 2003  Jan Hubicka  <jh@suse.cz>
	* cfgcleanup.c (try_simplify_condjump): Avoid unreachable code warning.
Index: cfgcleanup.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cfgcleanup.c,v
retrieving revision 1.68.2.5
diff -c -3 -p -r1.68.2.5 cfgcleanup.c
*** cfgcleanup.c	3 Jul 2003 18:04:24 -0000	1.68.2.5
--- cfgcleanup.c	6 Sep 2003 07:44:30 -0000
*************** try_simplify_condjump (cbranch_block)
*** 125,130 ****
--- 125,132 ----
    basic_block jump_block, jump_dest_block, cbranch_dest_block;
    edge cbranch_jump_edge, cbranch_fallthru_edge;
    rtx cbranch_insn;
+   rtx insn, next;
+   rtx end;
  
    /* Verify that there are exactly two successors.  */
    if (!cbranch_block->succ
*************** try_simplify_condjump (cbranch_block)
*** 177,182 ****
--- 179,198 ----
    cbranch_fallthru_edge->flags &= ~EDGE_FALLTHRU;
    update_br_prob_note (cbranch_block);
  
+   end = jump_block->end;
+   /* Deleting a block may produce unreachable code warning even when we are
+      not deleting anything live.  Supress it by moving all the line number
+      notes out of the block.  */
+   for (insn = jump_block->head; insn != NEXT_INSN (jump_block->end);
+        insn = next)
+     {
+       next = NEXT_INSN (insn);
+       if (GET_CODE (insn) == NOTE && NOTE_LINE_NUMBER (insn) > 0)
+ 	{
+ 	  reorder_insns (insn, insn, end);
+ 	  end = insn;
+ 	}
+     }
    /* Delete the block with the unconditional jump, and clean up the mess.  */
    flow_delete_block (jump_block);
    tidy_fallthru_edge (cbranch_jump_edge, cbranch_block, cbranch_dest_block);


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