[RFC] Mixed results with O(1) PHI arg lookup

Kenneth Zadeck zadeck@naturalbridge.com
Fri Nov 5 23:43:00 GMT 2004



Kazu Hirata wrote:

>Hi Paolo,
>
>  
>
>>You could add a BB_HAS_ATTACHED_INFO flag on bb's with PHI nodes, and
>>only call the hooks if it is set.  The insn-attrtab performance looks great.
>>    
>>
>
>I might worsen the performance because you can check if a BB has any
>PHI node with "if (phi_nodes (bb)) ...".
>
>  
>
so I guess the obvious next step is to have the code that calls the hook 
check to see if is null and arrange that the hooks are set when we are 
in ssa form and cleared when we are not in ssa form. 

This should be a little cheaper than checking either the predicate or 
phi_nodes (bb) test.  I would assume that once you are in ssa form, 
almost all join nodes have phi functions.

Kenny

>Anyway, I did a coverage testing on cc1-i files to see how many times
>we are calling the new CFG hooks in what situation.  Here are the
>details.
>
>Edge addition
>-------------
>
>2233672 - # of edges we add during the entire compilation
>1426834 - # of edges we add while we are in tree
> 976070 - # of edges we add while we are in tree SSA
> 300640 - # of edges we add to those destination basic blocks with PHI
>          nodes
>
>Edge removal
>------------
>
>1565032 - # of edges we remove during the entire compilation
>1095958 - # of edges we remove while we are in tree
>1012294 - # of edges we remove while we are in tree SSA
> 284838 - # of edges we remove from those destination basic blocks with
>          PHI nodes
>
>Note that an edge redirection is counted as one addition and one
>removal.
>
>In either case, the new CFG hooks are at work less than 20% of time.
>In other words, more than 80% of the time, we are calling the new CFG
>hooks for nothing.
>
>I thought that most of the edges that are created come from CFG
>construction, but that's not true.  We create more edges outwide CFG
>consturction than we do we do inside CFG construction.  I guess if we
>split all critical edges, etc, we may get a lot of new edges from
>there.
>
>Kazu Hirata
>  
>



More information about the Gcc mailing list