[tree-ssa] Splitting abnormal edges

Andrew MacLeod amacleod@redhat.com
Mon Jun 16 15:53:00 GMT 2003


On Mon, 2003-06-16 at 10:50, Jeff Sturm wrote:
> On 16 Jun 2003, Andrew MacLeod wrote:
> > > The quick patch below fixes this case but isn't quite right, since it
> > > doesn't consider functions that longjmp or don't return.
> >
> > We do we care about those? If they have one Normal edge going out,
> > inserting after the stmt would still be fine would it not?
> 
> Provided that the successor along that one normal edge isn't the exit
> block, I think so.

Should still work even if it is the exit block I think... I ought to be
falling through to the exit block, so adding another stmt should be OK.

> 
> > So the default case in find_insert_location should check for
> > is_ctrl_altering_stmt, and return src->end_tree_p,and return
> > EDGE_INSERT_LOCATION_AFTER;
> >
> > LIke your original patch, excep check is_ctrl_altering_stmt() for true.
> >
> > If it isn't true, we should abort(). I was going to object to your
> > earlier patch because I wanted to make the default abort(). Now we
> > should  check this, then abort.  IS there a reason this doesn't work?
> 
> Seems like that should work.
> 
> > Try something like this. (DO we need any cases for CATCH, TRY or
> > anything else?)
> 
> TRY/CATCH are problematic because we're still building fallthru edges for
> those that will never actually be taken.  Jeff Law says they aren't safe
> to remove yet.  Is there a flag we can set to suppress the insert
> altogether?  What about EDGE_FAKE?
> 

I missed the note.. why are they unsafe to remove? We could hack around
it I suppose... 

> Did you intend to attach a patch to your message?  I didn't see one...
> 

Oops. Yes :-)

Andrew
	* tree-cfg.c (find_insert_location): Append after last stmt in SRC when
	block ends in a control altering stmt.


Index: tree-cfg.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-cfg.c,v
retrieving revision 1.1.4.108
diff -c -p -r1.1.4.108 tree-cfg.c
*** tree-cfg.c	14 Jun 2003 20:56:00 -0000	1.1.4.108
--- tree-cfg.c	16 Jun 2003 15:26:05 -0000
*************** find_insert_location (basic_block src, b
*** 3795,3802 ****
  	    break;
  
  	  default:
! 	    ret = dest->head_tree_p;
! 	    break;
  	}
      }
    else
--- 3794,3812 ----
  	    break;
  
  	  default:
! 	    if (is_ctrl_altering_stmt (stmt))
! 	      {
! 	        /* The block ends in a CALL or something else which likely has
! 		   abnormal edges.  In that case, we simple create a new block
! 		   right after this one, and then fall through to the 
! 		   destination  block.  */
! 		ret = handle_switch_split (new_block, dest);
! 		*location = EDGE_INSERT_LOCATION_AFTER;
! 		break;
! 	      }
! 
! 	    /* All cases ought to have been covered by now.  */
! 	    abort ();
  	}
      }
    else



More information about the Gcc-patches mailing list