This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch] Lno branch merge part 12 -- induction variable optimizations
- From: Dale Johannesen <dalej at apple dot com>
- To: Devang Patel <dpatel at apple dot com>
- Cc: Zdenek Dvorak <rakdver at atrey dot karlin dot mff dot cuni dot cz>, gcc-patches at gcc dot gnu dot org, Dale Johannesen <dalej at apple dot com>
- Date: Sat, 28 Aug 2004 13:36:00 -0700
- Subject: Re: [patch] Lno branch merge part 12 -- induction variable optimizations
- References: <20040828080737.GA16110@atrey.karlin.mff.cuni.cz> <33D3B174-F92F-11D8-BF13-000393A91CAA@apple.com>
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.