This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Operator Strength Reduction on trees
- From: Zdenek Dvorak <rakdver at atrey dot karlin dot mff dot cuni dot cz>
- To: Robert Kennedy <jimbob at google dot com>
- Cc: Steven Bosscher <stevenb dot gcc at gmail dot com>, gcc-patches at gcc dot gnu dot org
- Date: Sat, 13 Jan 2007 09:46:14 +0100
- Subject: Re: [PATCH] Operator Strength Reduction on trees
- References: <17832.8512.456187.436424@whippen.corp.google.com>
Hello,
> > +/* Return the last non-control statement in a basic block, or NULL if
> > + there is none. */
> > +
> > +static tree
> > +last_nonjump_stmt (basic_block block)
> > +{
> > + block_stmt_iterator last = bsi_last (block);
> > + tree stmt;
> > +
> > + if (bsi_end_p (last))
> > + return NULL_TREE;
> > + stmt = bsi_stmt (last);
> > +
> > + while (stmt_ends_bb_p (stmt))
> > + {
> > + bsi_prev (&last);
> > + if (bsi_end_p (last))
> > + return NULL_TREE;
> > + stmt = bsi_stmt (last);
> > + }
> > + return stmt; /* bsi_stmt (last); */
> > +}
> >
> > Was there ever a statement that was not bsi_last, which did end the
> > basic block? Seems to me that this means the block should have been
> > split. In other words, I don't believe you need the while loop
> > here.
>
> Is the while loop expensive? I don't see how two ifs (one to check,
> one to assert that the while loop isn't needed) would be better.
the loop obviously is not needed, you do not need to assert that
(and even if you do, the assert is removed from non-checking compiler,
so it does not count).
Zdenek