This is the mail archive of the gcc@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]

Re: COND_EXPR lowering patch


In message <20030823175250.GA21952@atrey.karlin.mff.cuni.cz>, Zdenek Dvorak wri
tes:
 >The main showstopper seems to be the tree-ssa-dce; after this change
 >it cannot work in the current form (resp. it could, but since most
 > of the interesting control flow will then be expressed by explicit
 > gotos, it would be useless).
Actually, as I've stated before, I believe the existing tree-ssa-dce
should continue to work, even after you've lowered COND_EXPRs because
we mark the parents of an incoming GOTO_EXPR as being necessary.

So if we have

 if (x)
   goto label1;
 goto label2;

 label1:
 if (y)
   goto label3;

 some code
 goto label4;

 label3:
 more code

As soon as something in the block starting at label3 is marked as
necessary, we look at the incoming edges and mark as necessary any
GOTO_EXPRs which reach our block.  Thus "goto label3" is entered
into the worklist.

When we process "goto label3", we mark its control parent as necessary
(the if (y) statement) and add it to the worklist.  At that time we'll
also mark the GOTO_EXPR which reaches this block as necessary (ie
the "goto label1" statement).

When we process the "if (y)" statement we mark whatever statements
set "y" as necessary.

When we process "goto label1", we'll mark its control parent as necessary
(if (x)).

etc etc.


 >It was discussed before, but afair there was not any definitive
 >conclusion.  To me the following scheme seems to be the best:
 >The control structures removal part will only be activated with -O3
 >and will be done using regular control dependency analysis.
I would much prefer to not push this into -O3.  Instead I would rather
see the control structure removal happen at -O2, but only on the
final pass of DCE.

Marginally related, I'm pretty sure DSE will need the post-dominators
to do a good job.  It may make sense to have DCE/DSE share the cost
of building the post-dominator information.

jeff


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