[patch] Lno branch merge part 12 -- induction variable optimizations

Dale Johannesen dalej@apple.com
Sat Aug 28 21:47:00 GMT 2004


> On Aug 28, 2004, at 1:07 AM, Zdenek Dvorak wrote:
>
>> + /* Finds iterator for STMT.  */
>> +
>> + extern block_stmt_iterator
>> + stmt_bsi (tree stmt)
>> + {
>> +   block_stmt_iterator bsi;
>> +
>> +   for (bsi = bsi_start (bb_for_stmt (stmt)); !bsi_end_p (bsi); 
>> bsi_next (&bsi))
>> +     if (bsi_stmt (bsi) == stmt)
>> +       return bsi;
>> +
>> +   abort ();
>> + }
>
> I decided to not use this approach because of performance cost. I used 
> two alternatives instead, 1) supply bsi as parameter 2) use bitmap.
>
> If you think, performance implications are not considerable than make 
> remove_statement() also externally visible :-).

I am having to introduce a similar function in the tree form of 
value-based profiling.
I am also concerned about the cost (for general use; value-based 
profiling is not
a bottleneck) but I think the functionality needs to be there.
Perhaps it is time to add an "up" pointer in the data structures so we 
can do this
more efficiently.    In the meantime, I think a comment warning about 
the inefficiency
would be a good idea.

(Passing 3-word bsi's through several levels of interface is not so 
good either, btw.)

I would prefer the name bsi_for_stmt; it is closer to existing 
convention, and having
both stmt_bsi and bsi_stmt is going to be very confusing.



More information about the Gcc-patches mailing list