How to debug ssa optimizer

Richard Kenner kenner@vlsi1.ultra.nyu.edu
Sun Jun 20 17:12:00 GMT 2004


    > I was just about to add a test to check_pointer_types_r to disallow it.

    :-) All you'd have to do is remove the one that's already there.

OK, more is clear now, but there's still a hole.

version_string in c-cppbuiltin.c has an incomplete type.

We're trying to cprop and we make *&version_string.

maybe_fold_stmt_indirect calls maybe_fold_offset_to_array_ref.  I had
modified that to fail if the lower bound is unknown.  But then
maybe_fold_stmt_indirect just folded out the *&B to B.  But that's only safe
if the types were compatible.

If I now changed it to only do the folding if the types are compatible.  But
then it leaves it as *& and get_stmt_operands blows up.

Of course, the proper fix here is to allow maybe_fold_offset_to_array_ref to
operate if TYPE_DOMAIN isn't there because the lower bound should be treated
as zero.  I did that.

But I have two questions:

(1) If maybe_fold_stmt_indirect fails all cases (which I think is at least
theoretically possible), it'll make invalid GIMPLE.  That seems wrong.

(2) Why are there separate fold routines in tree-ssa-ccp.c?  Wouldn't it 
be better to add all these cases into fold and then call it?  Or is the
issue that the cases in fold don't ensure things stay GIMPLE?



More information about the Gcc mailing list