[tree-ssa]: PRE updates and note on bug
Daniel Berlin
dberlin@dberlin.org
Tue Jul 22 22:06:00 GMT 2003
On Tuesday, July 22, 2003, at 2:27 PM, Andrew MacLeod wrote:
> On Tue, 2003-07-22 at 14:19, Daniel Berlin wrote:
>>
>>> As I said, it could be the reverse iterators.
>>> If the end of the bb is an empty statement, bsi = bsi_last (bb);
>>> bsi_prev (bsi), doesn't work.
>>
>> As an FYI, the reason it doesn't work is because of bsi_last:
>>
>> /* If the last stmt pointer isn't something a BSI can represent
>> (ie, an
>> empty statement node), then find the last stmt the slow way. */
>> if (b.tp == NULL)
>> {
>>
>>
>> This condition is wrong for the comment.
>> If BSI's can't represent empty statement nodes, it needs to check
>> at least
>> 1. IS_EMPTY_STMT (*b.tp)
>> and I believe
>> 2. If *b.tp == COMPOUND_EXPR, IS_EMPTY_STMT (the first operand).
>>
> b = bsi_init (bb->end_tree_p, bb);
>
> The call to bsi_init() above it ought to be setting b.tp to NULL if it
> can't be represented by a BSI node. (like an empty stmt node of a
> BIND_EXPR or whetever).
Well, it's not in some cases, particularly, empty statement node cases.
:)
I presume this is because bsi_init only looks *forwards* for the next
non-empty statement, when for bsi_last, it needs to look *backwards*.
I was getting an empty stmt for end of bb using last_stmt and
last_stmt_ptr, but if i replace it with:
{
block_stmt_iterator bsi2;
block_stmt_iterator bsi3;
for (bsi2 = bsi3 = bsi_start (bb);
!bsi_end_p (bsi2);
bsi_next (&bsi2))
bsi3 = bsi2;
endtree = bsi_stmt (bsi3);
endtreep = bsi_stmt_ptr (bsi3);
}
(which is the code that bsi_last falls back on), it works fine and
gives the correct statement.
> The NULL condition means it cant be
> represented...
>
> Andrew
>
More information about the Gcc-patches
mailing list