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


On Mon, 2003-08-25 at 18:00, Zdenek Dvorak wrote:
> Hello,

> 
> No, it will happen always -- you cannot create a condition in lowered
> for that would not be marked useful.
> 

sure we can.


> 
> uh?  Then you probably have other idea about the shape "lowered
> COND_EXPRs" should have.  In what I do, this would look like
> 
> if (a)
>   goto x;
> else
>   goto y;
> 
> x:
>   (void)0
> goto z;
> 
> y:
>  (void)0
> z:


If we change the algorithm to not use parent_stmt, and instead use
control dependence information, I see no reason why this wouldn't be
eliminated.

explicit GOTO's will never be marked as necessary by the algorithm. They
are implicited marked based on whether the edge remains or not.

so If i understand what this is going to look like:

BB 0
  if (a)
     goto x;
  else
     goto y;

BB1
  x:
    (void)0                 // A
  goto z;

BB2
  y:
    (void)0                 // B
  
BB3:
  z:
   stmt;

Marking 'stmt' as necessary is not going to mark any control stmts as
necessary. When using control dependancies, only *conditional* control
flow on dependant edges gets marked, so the goto's are not.

If we had a stmt in location A or B, then the if (a) would be marked as
necessary since it is a conditional control flow stmt on a control
dependant edge.

Right now, if there is a PHI node in block 3, then we would mark the
conditional as necessayr because the PHI node may have to insert copies
on one or both of the conditional 's branches. That then only condition
under which the if() in block 0 would remain.

Andrew


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