This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Patch to allow Ada to work with tree-ssa


    You also managed to add another quadratic algorithm somewhere,
    see gcc.gnu.org/PR16163.  Can you please fix this asap.

Well, it's only quadratic due to the way the testcase is constructed.  And
the reason is due to something that I already know about and will be fixed by
a change I plan to make soon anyway.

The issue here is that the tree walker didn't used to look at the fields of
types.  So it missed variables in DECL_FIELD_OFFSET, for example.  Now that
it does, the cost of walking through a type is proportional to the number of
fields in the type.

This particular test case has one statement for each field.  Since the cost
of processing each reference to a record is linear in the number of fields in
a record, if you have an number of statements proportional to the number of
fields, you get the "quadratic" behavior.

The root of this problem is that you really only have to walk the fields
inside a type for the *definition* of a type, not its use.  But there's no
way yet for the tree walker to know that a type is being defined instead of
being used.

However, pretty close to the top of my list is adding DECL_EXPR as a GENERIC
node and using it instead of DECL_STMT that's used by both C/C++ and Ada.
Once that happens, the tree walker can be modified to only look inside types
that are the operand of a DECL_EXPR.

I'll be doing that within a couple of days.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]