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]

[vta] skip debug insns in purge_dead_edges


If there are debug insns after a call, we must locate the call rather
than the debug insn for the processing of purge_dead_edges(),
otherwise we make different decisions and generate different code.

Fixed as follows.

for  gcc/ChangeLog.vta
from  Alexandre Oliva  <aoliva@redhat.com>

	* cfgrtl.c (purge_dead_edges): Skip debug insns at the end, along
	with notes among them.

Index: gcc/cfgrtl.c
===================================================================
--- gcc/cfgrtl.c.orig	2008-10-10 09:31:06.000000000 -0300
+++ gcc/cfgrtl.c	2008-11-17 04:59:17.000000000 -0200
@@ -2151,6 +2151,11 @@ purge_dead_edges (basic_block bb)
   bool found;
   edge_iterator ei;
 
+  if (DEBUG_INSN_P (insn) && insn != BB_HEAD (bb))
+    do
+      insn = PREV_INSN (insn);
+    while ((DEBUG_INSN_P (insn) || NOTE_P (insn)) && insn != BB_HEAD (bb));
+
   /* If this instruction cannot trap, remove REG_EH_REGION notes.  */
   if (NONJUMP_INSN_P (insn)
       && (note = find_reg_note (insn, REG_EH_REGION, NULL)))
@@ -2171,10 +2176,10 @@ purge_dead_edges (basic_block bb)
 	 latter can appear when nonlocal gotos are used.  */
       if (e->flags & EDGE_EH)
 	{
-	  if (can_throw_internal (BB_END (bb))
+	  if (can_throw_internal (insn)
 	      /* If this is a call edge, verify that this is a call insn.  */
 	      && (! (e->flags & EDGE_ABNORMAL_CALL)
-		  || CALL_P (BB_END (bb))))
+		  || CALL_P (insn)))
 	    {
 	      ei_next (&ei);
 	      continue;
@@ -2182,7 +2187,7 @@ purge_dead_edges (basic_block bb)
 	}
       else if (e->flags & EDGE_ABNORMAL_CALL)
 	{
-	  if (CALL_P (BB_END (bb))
+	  if (CALL_P (insn)
 	      && (! (note = find_reg_note (insn, REG_EH_REGION, NULL))
 		  || INTVAL (XEXP (note, 0)) >= 0))
 	    {
-- 
Alexandre Oliva           http://www.lsd.ic.unicamp.br/~oliva/
You must be the change you wish to see in the world. -- Gandhi
Be Free! -- http://FSFLA.org/   FSF Latin America board member
Free Software Evangelist      Red Hat Brazil Compiler Engineer

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