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: [PATCH, tree-dce]: DCE enh to handle dead calls (not pure)


On Sat, May 17, 2008 at 5:45 PM, Xinliang David Li <davidxl@google.com> wrote:
> // This is an trivial example
> #include <math.h>
>
> void foo(double x)
> {
>
>   double y;
>
>   y = log(x);
>
>   return;
>  }
>
>
>
> // Gimple dump after dce
>
> ;; Function foo (foo)
>
> foo (double x)
> {
>  _Bool DCE_COND_TEST.26;
>  double DCE_COND.25;
>
> <bb 2>:
>  DCE_COND.25_2 = x_1(D);
>  DCE_COND_TEST.26_3 = DCE_COND.25_2 <= 0.0;
>  if (DCE_COND_TEST.26_3)
>    goto <bb 3> (<L2>);
>  else
>    goto <bb 4> (<L1>);
>
> <L2>:;
>  log (x_1(D));
>
> <L1>:;
>  return;
>
> }

OK, this is something we probably don't want to do when optimizing for
size (i.e. at -Os).  You'll have to add code to disable this
transformation if optimize_size is set (probably do it in opts.c, see
what's done there for flag_tree_pre).


>> Third, at least for my taste you have *way* too many gcc_asserts.
>> They are not free, you know, and you are asserting trivial things and
>> things that you have already asserted before.  For example, in the
>> gen_conditions_for* functions you re-assert everything you already
>> asserted in the check* functions. Please reconsider whether you really
>> need all of them.  gcc_assert is not free and also doesn't improve the
>> readability of the code...
>>
>
> Maybe we need to introduce a gcc_dbg_assert. Is it there already?

There is nothing like that.  I don't think anyone really wants this either ;-)


> Ah, this is something I like to change systematially in gcc in the future --
> all high level transformations will emit info messages -- for performance
> tuning/triaging reason

Why?  What would that give you that the dumps and the statistics stuff
do not give you already?

Gr.
Steven


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