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: ivopts improvement


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


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