This is the mail archive of the gcc-patches@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: [VTA] retain more debug info in loop-ivopts


On Sep  4, 2009, Richard Guenther <richard.guenther@gmail.com> wrote:

> Well IMHO a good trade-off instead of adding worst-case quadratic
> workarounds everywhere.

You seem to be overreacting to the O(n^2).  Remember that quicksort is
also quadratic in the worst case.  Nevertheless, we use it âeverywhere
and then someâ (i.e., more than once), don't we? :-)


The piece of code in this patch will exhibit quadratic behavior in
essentially the same pathologic case that quicksort would.

Namely, given a chain of DEFs such that, for every n > 1, the definition
of SSA version n uses SSA version n-1.

In the normal case, the code at hand will be slightly superlinear,
because SSA version names are not chained like that: they're even
randomized to some extent.

There's no even a reason to worry about long USE chains.  When we reach
that point, former USEs will have already been rewritten, so other uses
are most certainly other DEFs to be removed too, and we'll break out
when we find the first one.  The inner loop would only taken superlinear
time if lots of debug stmts are examined before a non-debug USE to be
removed.

IOW, there's no reason to panic ;-)


> A more convincing option would be to not delete the stmts in IVOPTs
> but instead rely on a later DCE.  Does that work and generate equivalent
> code?

I'll give it a try.  Here's how I'm going to test it: write a scratch
patch that introduces option to disable the call to remove_unused_ivs,
and then run a stage3 build with GCC_COMPARE_DEBUG=-fthat-option.  Then
every file will be compiled with and without that option, and compared.
Cool, eh? :-)

>>> Shouldn't propagate_var_def_into_debug_stmts deal with the situation
>>> and not propagate?

>> It could. ÂThis would hide the unnecessary loss.

> Good.

?!?

-- 
Alexandre Oliva, freedom fighter    http://FSFLA.org/~lxoliva/
You must be the change you wish to see in the world. -- Gandhi
Be Free! -- http://FSFLA.org/   FSF Latin America board member
Free Software Evangelist      Red Hat Brazil Compiler Engineer


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