On Mon, 6 Jun 2016, Jan Hubicka wrote:

> > On Sun, 5 Jun 2016, Jan Hubicka wrote:
> > 
> > > Hi,
> > > both loop-ch and loop-ivcanon want to trottle down the heuristics on paths
> > > containing call. Testing for presence of GIMPLE_CALL is wrong for internal
> > > call and cheap builtins that are expanded inline.
> > > 
> > > Bootstrapped/regtested x86_64-linux, OK?
> > 
> > First of all the name is bad - I'd say gimple_inexpensive_call_p ()
> > is better.  More comments below.
> 
> OK, the motivation for name is that I am really testing if the GIMPLE_CALL 
> will end up
> call instruction in the final assembly. No matter whetehr expensive or not.

Well, but that's not what your predicate tests ;)  For example
CLZ is considered is_inexpensive_builtin even though it may end up
as a call.  In fact even non-calls can end up as a libcall on
some targets.

> > gimple_code (stmt) == GIMPLE_CALL is redundant then.  I'd prefer to
> > make gimple_inexpensive_call_p take a gcall * argument and do the
> > test at the callers though.
> 
> OK, i will update patch.  I had mostly copied those tests from original
> code which I think had them as short cirucuits. This most probalby does not
> matter in practice and LTO may be eventually to do that for us. So it seemed
> bit like premature optimization.  I will update the patch.

Thanks,
Richard.

> Honza
> > 
> > >       {
> > >         int flags = gimple_call_flags (stmt);
> > > -       tree decl = gimple_call_fndecl (stmt);
> > > -
> > > -       if (decl && DECL_IS_BUILTIN (decl)
> > > -           && is_inexpensive_builtin (decl))
> > > -         ;
> > > -       else if (flags & (ECF_PURE | ECF_CONST))
> > > +       if (flags & (ECF_PURE | ECF_CONST))
> > >           size->num_pure_calls_on_hot_path++;
> > >         else
> > >           size->num_non_pure_calls_on_hot_path++;
> > > 
> > > 
> 
> 

-- 
Richard Biener <rguent...@suse.de>
SUSE LINUX GmbH, GF: Felix Imendoerffer, Jane Smithard, Graham Norton, HRB 
21284 (AG Nuernberg)

Reply via email to