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] [C++] speedup cp_tree_chain_matters_p


Andrew Pinski <pinskia@physics.uc.edu> writes:

> On Mar 30, 2004, at 03:12, Zack Weinberg wrote:
>> No.  Find out why sibcall optimization doesn't trigger for the
>> original code and fix that instead.
>
> The reason why it is not sibcalled is because c_tree_chain_matters_p
> returns an int so the || statement becomes f()!=0||g()!=0 which becomes
> if (f()!=0)
>    return true;
> return g()!=0;
>
> So one thing to do is change the return type c_tree_chain_matters_p to
> return bool but that will still not fix it.
> This example is not sibcalled at all:
> _Bool f();
> _Bool g();
> _Bool h()
> {
>    return f() || g();
> }

Sibcall optimization should apply to both these examples.  There's no
good reason why users should have to obfuscate their code to make it
trigger.  Does tree-ssa do better here?

zw


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