This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: ivopts improvement
- From: Paolo Bonzini <bonzini at gnu dot org>
- To: Tom de Vries <vries at codesourcery dot com>
- Cc: Zdenek Dvorak <rakdver at kam dot mff dot cuni dot cz>, Richard Guenther <richard dot guenther at gmail dot com>, gcc-patches at gcc dot gnu dot org, Bernd Schmidt <bernds at codesourcery dot com>, Maxim Kuvyrkov <maxim at codesourcery dot com>
- Date: Thu, 03 Mar 2011 09:44:59 +0100
- Subject: Re: ivopts improvement
- References: <4D6B6DB9.7050302@codesourcery.com> <4D6B7AFD.6000201@gnu.org> <4D6BAF92.3030707@codesourcery.com> <4D6BB48A.9090003@gnu.org> <AANLkTi=-0CJ=W7JXYs9sBZw7ic6W0SYU9tmJVr+YHh5J@mail.gmail.com> <20110228181222.GA24295@kam.mff.cuni.cz> <4D6EBE2A.10002@codesourcery.com>
On 03/02/2011 11:01 PM, Tom de Vries wrote:
+ if (TREE_CODE (nit) == COND_EXPR)
+ {
+ if (!loop_only_exit_p (loop, exit))
+ return false;
+
+ return iv_elimination_compare_lt (use, cand, bound, nit, comp);
+ }
+
You probably need a comment on top of iv_elimination_compare_lt,
otherwise I'm left wondering why this isn't
if (TREE_CODE (nit) == COND_EXPR
&& loop_only_exit_p (loop, exit)
&& iv_elimination_compare_lt (use, cand, bound, nit, comp))
return true;
Also, the check on nit is an optimization. Perhaps you should add a
gcc_checking_assert to i_elimination_compare_lt and/or remove this from
get_lt_bound:
+ if (TREE_CODE (nit) != COND_EXPR)
+ return NULL_TREE;
+
Or perhaps loop_only_exit_p could be optimized by computing it ahead of
time, possibly at the same time as loop_body_includes_call. This way it
becomes very cheap and the code above can just call
iv_elimination_compare_lt without any pre-screening.
Paolo