[tree-ssa] COND_EXPR lowering.

Andrew MacLeod amacleod@redhat.com
Fri Oct 24 17:01:00 GMT 2003


On Fri, 2003-10-24 at 12:49, Diego Novillo wrote:
> On Fri, 2003-10-24 at 12:41, Andrew MacLeod wrote:
> > On Fri, 2003-10-24 at 12:32, Diego Novillo wrote:
> > > On Fri, 2003-10-24 at 09:22, Andrew MacLeod wrote:
> > > 
> > > > The only other thing that I think Diego agreed with (yes? no?) is that
> > > > we probably ought to set the BB for the 2 goto's on the arms of the
> > > > COND_EXPR. Yeah, they aren't real stmt's, but there is no reason someone
> > > > couldn't look at them as real stmts.. ie, someone doing path following
> > > > may want to process the 2 arms exactly like they process a GOTO, so we
> > > > ought to make them behave like a GOTO stmt for consistancy, so we ought
> > > > to set their BB.
> > > >
> > > Agreed.  It's easy enough to change set_bb_for_stmt() to do this
> > > automatically when applied to the COND_EXPR node.
> > > 
> > If we were to do it, that wouldnt be good enough. Anyone that later
> > changes the THEN or ELSE branch would have to update that GOTO as well,
> > so it is more maintenance.
> > 
> Why?  Statement replacement always preserves the existing basic block
> for the statement.  And if something is going to change the block for
> one of the GOTOs without changing the COND_EXPR, that's a bug.
> 

We dont always use stmt replacement do we?

the insert_on_edge routines update the COND and THEN parts directly, so
it has to be changed there. Perhaps it would be limited to those 2
places, Im not sure. 

Anyone can replace the GOTO_EXPR in the THEN or ELSE side. If they just
change the DESTINATION_LABEL, the block would still be set. If they
change the GOTO_EXPR as a whole, then they have to update the BB on the
new GOTO.  If I were changing the destination of one of the branches, it
wouldn't actually occur to me to build a new COND_EXPR and use
bsi_replace() That seems like overkill :-)  

Andrew



More information about the Gcc-patches mailing list